Battleship or Manipulating children of a group

@Nikolay @Stefan @beg @Daniel_Pers @ElenaRenn @mikhailo

Anybody?

I am creating a battleship game. An enemy position is a group made of a Circle and a textMarker. In my example code only D6 is an enemy position.
Some pseudocode…

The player clicks an enemy position.
Play cannon fire sound.
If the enemy position has a ship in it
play explosion sound, change enemy position color to red
else
change enemy position color to white

I don’t know how or if it’s possible, to create my own objects like I would in C++.
So I’m creating an object, enemy position, by using a group.
The group contains a Circle and a textMarker. The circle is the visual part of the object seen by the player. The textMarker will have an opacity of zero. The textMarker text attribute will act as a boolean value; either “TRUE” or “FALSE”.
I will have to create a group for each enemy target. All enemy targets start as light blue(Circle.Material). All enemy targets will start as either “TRUE” or “FALSE”(textMarker.Text) depending on the algorithm that places the enemy ships.

My code example, https://cospac.es/jXjR, shows my group has two children.
Questions…
Is there a way to avoid this grouping work around and just make my own object?
How do I change the color of the Circle or the text of the textMarker?
How do I read the text of the textMarker?
Does the child index start with 0 or 1?
Is there a way to create a 2-dimensional array? i.e. a lists where each element is another list

This is the foundation of my game. I have to be able to store, change and retrieve data about the enemy AND player positions(because the computer will fire back).

I appreciate any help you give.

Hi @MrWolken

I have played with your scene a little. I created a list of boolean lists where I store the information - if the target was clicked before.
To make it look like a game-prototype I choose a cell and place a pyramid on it. If you click that cell, the result will be different.


It is possible to store that information in visual form (check the color, for example. If it is blue, then the cell was not clicked). But the boolean structure makes it easier.
I have also renamed all the targets so I can process them easily.

Hope that helps. Feel free to ask any question. I will look forward to see the result

Yes! I knew there had to be a better way.The boolean array greatly helps this.
I am playing with it now. You used CreateTarget to create a single target. I believe for gameplay I’ll set up a second boolean array to all the targets, aka store ship positions, in it.

What is the print [myVar] to console? In house terminal command?

Thank you.

Upd: This block is internal. You can delete or ignore it. I used it for debugging.