No actually, each object has been added once to my GameObjectList.
The regular code works fine, all enemies move from left to right and back again (just like space invaders).
This is done with a simple For EachIn cycle with a Update and Draw method. All fine so far.
Now when one of the enemies hits the x-margin, the direction (a global variable 1/-1) is changed, this works fine. But i want it to also move all enemies down (y) 20 points when the x-margin is hit. The problem is that the trigger happens with the For EachIn loop and i want to update the y of all enemies at that moment. Just a simple :
For Local e:TEnemy EachIn GameObjectList
e.y :+ 20
Next
The hard part is to have it do this once for every object. At this moment it will move all my objects down of the screen. So i cant get it to stop doing +20 or when i restrict the change it leaves the first object (the one that set off the trigger) at the original y position or it moves random objects on y and leaves others alone.
The regular code works fine, all enemies move from left to right and back again (just like space invaders).
This is done with a simple For EachIn cycle with a Update and Draw method. All fine so far.
Now when one of the enemies hits the x-margin, the direction (a global variable 1/-1) is changed, this works fine. But i want it to also move all enemies down (y) 20 points when the x-margin is hit. The problem is that the trigger happens with the For EachIn loop and i want to update the y of all enemies at that moment. Just a simple :
For Local e:TEnemy EachIn GameObjectList
e.y :+ 20
Next
The hard part is to have it do this once for every object. At this moment it will move all my objects down of the screen. So i cant get it to stop doing +20 or when i restrict the change it leaves the first object (the one that set off the trigger) at the original y position or it moves random objects on y and leaves others alone.