ios - Call event every random number -
im trying work out how event every random number. using following random number between 50 + 100
int x = (arc4random() % 50) + 50;
i want call selector based on returned value so.
[_hero schedule:@selector(randomanimation) interval:x];
im trying work out in head how rerun schedule after random time new random time
.
in _hero class randomanimation method :
-(void) randomanimation { // animation stuff here // int x = (arc4random() % 50) + 50; [self scheduleonce:@selector(randomanimation) delay:x]; }
and fire sequence
[_hero randomanimation];
edit : if dont want expose randomanimation method, fire animation when object added scene :
-(void) onenter { [super onenter]; [self randomanimation]; }
Comments
Post a Comment