Hey everybody,
so after a week I managed to get my first little app running on my own phone. Even as I am not programmer I am geek enough to feel a little pride there.
But here is the thing… I am NOT a programmer… so I guess I am doing a lot of overcomplicated stuff and now am not getting it to work for multiple objects.
Basically now I have an “enemy” consisting of a group with 2 objects. I let it randomly appear and disappear and when you use a swipe gesture over one of the picture I catch it via the a
Runtime:addEventListener and calculate if during the move face the x and y coordinates collide with the x and y of the enemy.object1 before it disappears.
So far so good when I tried to spawn multiple enemies I used a table and would create a random number of enemies now when the function is called at the first time I would know how many enemies are on the display. But after a random number of seconds I destroy the old ones and create new ones in a higher index.
So lets say first time I create 3 and second time I create 3 then I have enemy[1]…enemy[2] etc.
also let’s say at the second time the first 3 are deleted so all currently exist is enemey[4],enemy[5] and enemy[6]
So here my question:
1.) Is there a better method to detect if the user has “hit”, used a touch gesture to hit one or multiple enemies
2.) Assuming my current method is correct… how do I know the index values of the table of the enemies that are currently displayed so I can get their position and see if they were hit?
I know that was a lot to read.
Thanks in advance.
-Gerd