How to create the game battle ship with a gui

조회 수: 12 (최근 30일)
Amanda
Amanda 2022년 12월 3일
답변: Image Analyst 2022년 12월 3일
I am trying to recreate the game battleship using a gui. For the game i want to have a 5x5 gride, I want a button that randomizes where three different ships go. I want one ship to take up 2 grid space, one take up 3, and one take up 4. I want them to be randomized horizontally or vertically. I want the player to be able to hit the randomize button and then start guessing where the ships are by calling out the gride space such as A1, B7.... If a part of the ship is hit I want it to say hit and turn the space red, if it wasnt hit I want it to say miss and turn the space blue, and then if you hit the whole ship it says sunk. I have no idea how to do this any help would be appreciated.
  댓글 수: 2
Fifteen12
Fifteen12 2022년 12월 3일
Do you have to use MATLAB? If you're looking for help writing a game, I would recommend a different platform. If you have to use MATLAB, then what part are you looking for help with? You might want to make your question a little more specific, as I'm not sure if you need help on making a gui, or on the game logic, or even plotting, etc.
Amanda
Amanda 2022년 12월 3일
I have to use matlab. I need help making the Gui and the Game Logic

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2022년 12월 3일
@Amanda click on the battleship tag on the right hand side of this page and you'll find 29 discussions.
In addition, you'll find the games in the File Exchange:

카테고리

Help CenterFile Exchange에서 Number games에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by