I want to CCRepeat a sequence until a condition becomes true. I know you can set a fixed amount of times a sequence can repeat but in my game it's not going to be a fixed number and should keep repeating until either variable1 becomes a certain number or variable2 becomes a certain number. How would I do that?
Repeat sequence until event becomes true
(3 posts) (2 voices)-
Posted 4 months ago #
-
How about using this...
-(void) seqToCall:(CCNode *) sender { [sender stopAllActions]; if (condition) //your condition { return; } id yourAction = [CCMoveBy actionWithDuration:1 position:ccp(5, 0)]; //Perform your action here id seq = [CCSequence actions:yourAction,[CCCallFunc actionWithTarget:self selector:@selector(seqToCall:)], nil]; }Posted 4 months ago # -
@ knightkrows: Thanks. Although I didn't use exactly the same thing, I used something similar to it and it works.
Posted 4 months ago #
Reply
You must log in to post.