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.
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
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.
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.