1
votes

I have two animations of a goalkeeper with two different states (with ball and without ball). After keeper jumps I want to switch to a different action but I want to stay at the same frame index.

I mean if goalkeeper collides with the ball in the frame 19, the second action should start at frame 19 too.

1

1 Answers

0
votes

I'm still not quite sure if I completely understand what your trying to do but I can help you with that action. If you want to run a check every frame you should do somethng like this

At the end of your scenes init method add:

` [self schedule: @selector(tick:) interval: 0.3f];

-(void)tick:(ccTime) dt { if(CGRectIntersectsRect(goalKeeper.textureRect, ball.textureRect) { [goalKeeper stopAction: myAction]; //where myAction is previously defined } //now you can start the new action because you're using a timer, it'll be the same frame

That should do it. I hope that helps, if I still didn't quite answer your question feel free to clarify what in more vivid what exactly you're going for. `