I have this code:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:temp/10.0f
target:self
selector:@selector(verify)
userInfo:nil
repeats:YES];
CCMoveTo *moveTo = [CCMoveTo actionWithDuration:temp position:positionX];
id doneAction = [CCCallFuncN actionWithTarget:timer selector:@selector(invalidate)];
id sequence = [CCSequence actions: moveTo, doneAction, nil];
[self.container runAction:sequence];
the problem is that the timer is not invalidated and continues to run after the animation ends.
what am I missing?
thanks.
Change your
CCCallFuncNtoCCCallFuncCCCallFuncN looks for an object to pass into the function using
withObject:. You don’t need this.