Hi. I'm making a Space Invaders clone and having trouble working out the logic for when the aliens reach the edge of the screen and drop down a level.
At the moment I have a direction variable set to 1 (for right). Every second the aliens move 10 pixels to the right. I've got it checking for the one of the aliens X coord being >= 900 (just to the left of the screen edge. At that point I set a variable named aliendrop to 1 which tells it to drop all aliens down 20 pixels and change the direction variable to 0 (the left).
Now this works, ish, except that there's a second until the aliens move back below 900 again. In that short period the section that moves the aliens down if the X is >= 900 is executed over and over.
Has anyone any ideas how I should structure it so that the ADD Y is only done once per direction.
I hope I explained it well, it's hurting my brains. lol
Thanks.