Hi there!
I am making a space invaders game for iphone with xcode. You can move the ship to the right or to the left when pressing the right or the left part of the window.
The "enemies" appear randomly at the top of the window, but the problem is that when a new enemy appears, the ship returns to the initial position, which is bottom center.
An example: say that you want to move the ship to the right, so you press the window and the ship moves towards the x direction, but when a new invader comes in, the ship returns automatically to its initial position.

I'm using a custom UIView class for the ship and I overwrote the drawRect: method. The invaders are UIImageView class images and I add them to the main view.

Any help or suggestion?

Thanks in advance!

EDIT: I realised that when pressing a button that changes the view, the ship also returns... So I imagine that the problem is that when I update the view, the ship goes back...
Please help! Smile | :)

This is a bit late and you haven't posted any code but are you committing the animation after the movement has finished (via the commitAnimations method)? If not, the ship is moving with the animation command but it's actual location isn't changing so it is being redrawn in the intial location when your view is redrawn.

Location initialization codes must be invoked when new enemies enters. Set breakpoints on them, by clicking on the left side of the editing window.