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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -