Wait till all CCActions have completed

Posted by tGilani on Game Development See other posts from Game Development or by tGilani
Published on 2012-10-31T10:15:06Z Indexed on 2012/10/31 11:14 UTC
Read the original article Hit count: 387

I am developing a simple cocos2d game in which I want to animate two CCSprites simultaneously, and for this purpose I simply set CCActions on respective `CCSprite's as follows.

[first runAction:[CCMoveTo actionWithDuration:1 position:secondPosition]];
[second runAction:[CCMoveTo actionWithDuration:1 position:firstPosition]];

Now I want to wait till the animations are complete, so I can perform the next step. How should I wait for these animations to finish?

There are actually two method calls, the first one animates the objects via the code above and second call does the other animation.

I need to delay the second method call until the animations in first are complete. (I would not like to use CCCallFunc blocks as I want to call the second method from the same caller as the first one.

© Game Development or respective owner

Related posts about animation

Related posts about cocos2d-iphone