0

Good day. I am creating a turn-based strategy. It is necessary to implement a similar system of blocks / attacks on cells as in the game "Battleship", only I have 5 cells. I don’t understand how to make these 5 cells as one object, so that it would be convenient to match the Checked properties (hit / didn’t hit)

My mind was enough to create a bunch of separate objects that call the procedure for checking the limit of hits and blocks. Everything would be fine, but this is a scene on which a battle of two heroes with a set of characteristics and abilities is initiated, and this is already 5 cells of blocks and attacks from each hero, in total 20, plus, under certain conditions, attack cells can double. So the code becomes unreadable. Even as a beginner I understand this, but I do not have enough knowledge. I ask you to suggest in which direction to think and what to read in order to better navigate the topic.

  • 1
    Your question is not a good fit for SO, because it is too broad. But for inspiration you could take a look at the StackExchange Game Development site at https://gamedev.stackexchange.com/ . There is actually 15 discussions about "battleship" for you to study. I recommend you to not look into using components like checkboxes for the ships, but instead design a memory model for the battlefield (e.g. a two dimansional array), and the ships (e.g one dim. arrays). Then design a presentation class which simply draws the battlefield, based on the memory model, on e.g. the canvas of the form. – Tom Brunberg Feb 07 '23 at 21:25
  • I just took a closer look at those 15 discussions at [gamedev](https://gamedev.stackexchange.com/) and they might not actually be what you are hoping for. But there are plenty of game developing discussions and much to take on board in terms of knowledge. – Tom Brunberg Feb 07 '23 at 21:52
  • Thanks a lot, very cool! Topic closed – Виталий Пономарёв Feb 09 '23 at 09:57

0 Answers0