A CCActionSpawn
performs all these actions at once and in parallel. That means that you are not waiting until the animation is complete. Instead of using CCActionSpawn
you should use CCActionSequence
which performs all actions after each other.
Creating the sequence should look like this:
CCActionSequence *flipJump = [[CCActionSequence actions:[CCActionCallFunc actionWithTarget:self selector:@selector(begin)], jump, flip, actionMove, [CCActionCallFunc actionWithTarget:self selector:@selector(end)], nil];
Additionally you need to either set userInteractionEnabled
to TRUE
and FALSE
int the begin
and end
method or maintain another flag and use that flag inside the touch methods to check wether touches should be handled or not.
Example for first option:
-(void)begin
{
self.userInteractionEnabled = FALSE;
}
-(void)end
{
self.userInteractionEnabled = TRUE;
}