To solve my problem, I tried:
I tried calculating uid, but it is useless, because uid get recycled.
I tried adding family instance variable when red gets hit but that family instance variable affects all green sprites, and it does not differentiate sprites.
Description of a problem:
I spawn 3 sprites in a line, their order in a line is random. There is green sprite (Green), red sprite (Red) and blue sprite (BLue) in rows that get spawned like so:
..............Red Green Blue (dots.... represent blank space)
Green Red Blue
...................Green^ Red* Blue’’
Blue Green Red
A player will shoot at the sprites from the bottom. I have got this ready.
Sprite green has instance variable = 1, sprite Red = 2, sprite blue = 3
Then I generate random number 1, 2 or 3.
Let’s say I get 2. Then I want a player to shoot any of the Red Sprites, because they have instance variable 2, it is possible, because they move.
Let's say a player succeeds hitting sprite Red with an asterix Red*. I destroy the Red*, then I generate a number either 1 or 3.
Let’s say I get 1. NOW I want a player to hit ONLY sprite red’s Green^ neighbour EXCLUSIVELY. THIS IS WHERE THE PROBLEM IS. I CAN'T do it, because I do not know how to pick this particular sprite. I want the player to keep shooting but only hitting Green^ takes effect. Once a player would do it, I destroy Green^.
Then I want a player to shoot sprite marked with quotation marks Blue’’ EXCLUSIVELY just like the Green^ described above. I CAN'T do it.
After that the whole logic starts from the beginning with a random number selected.
I have got the shooting ready. I cannot do the destruction in the right order as described above.