Use UIView animations, for example in:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
object.center=CGPointMake(object.center.x+2, object.center.y+4);
[UIView commitAnimations];
You should also use NSTimer at the same interval so that you can seamlessly trigger animations.
NSTimer *timer=[NSTimer scheduledTimerWithTimeInterval:0.3 target: self
selector:@selector(animation) userInfo: nil repeats: YES];
Then we implement the method:
- (void)animation {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
object.center=CGPointMake(object.center.x+5, object.center.y+7);
[UIView commitAnimations];
}
This should make for ANY simple game.
GSchv source
share