August 6, 2009 0

Event.ENTER_FRAME / Run every frame

By admin in Uncategorized

Coming from a flash / actionscript / processing background I’m used to having a method I can call which I will run every frame.
No such per/frame function exist on the iphone (that I know of):

You do it using a timer, like so:
[NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
Place that into viewDidLoad for your .m

Then create the function to catch the loop.
- (void)onTimer {
[ball update];
}

Tags:

Leave a Reply

Powered by WP Hashcash

Spam protection by WP Captcha-Free