Hi all, I am trying to make a game for the iPhone/iPod Touch. I am somewhat new to iPhone programming and extremely new to iPhone game programming so try to bear with me if this is a stupid question. How to I make my character, a UIImageView, move to the right or left, along the x axis. Just a simple translation across the screen. This is very frustrating so if you could link me to a tutorial or something like that, it would be much appreciated. Thanks in advance, Tate
A:
Just set the frame value new. Example:
UIRect rect = [myImageView frame];
rect.origin.x += 10.0f;
[myImageView setFrame:rect];
But as the UIKit is good for UIs, it isn't good for games. Try switching to OpenGL by using a Engine like Cocos2D or Void Dead.
JustSid
2010-06-01 22:58:30
I'm confused. I get the error UIRect undeclared and rect undeclared. I'm clueless please help.
allthewayapps
2010-06-01 23:12:04
A:
I am still confused. Where do I put that code? I get an error UIRect undeclared and rect undeclared when I put it in the IBAction of a button. Please help.
allthewayapps
2010-06-01 23:43:06