0
\$\begingroup\$

I am new to cocos2d. I am using CCAnimation. It's working fine, except I want to pause the animation occasionally. How do I do this?

Here's what I'm doing so far:

[mySprite runAction:[CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim]]];
\$\endgroup\$
1
\$\begingroup\$

You can pause all the actions for a node, but not individually.

Basically you can do something like this

[[CCActionManager sharedManager] pauseTarget:node];

[[CCActionManager sharedManager] resumeTarget:node];
\$\endgroup\$
0
\$\begingroup\$

There's no pause per se. You can use stopAction or stopActionByTag to stop it and run it again when you want to resume.

Check the API here for these methods.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.