When you add an action to a sprite, since most things in Cocos are autoreleased, is it then released after it completes? Or, because you added it to a node, is it retained by the node?
If the action then ends, either due to completing on its own or because you stop it yourself, is it then released or is it still available to be run later?
I ask because I want to know if you need to recreate actions to reuse them, or if you can simply reference their tag and start and stop them at will whenever you want. Of if they repeat, if you can simply get them by tag number and then run them again; it’s not clear the “correct” way to go about this. Thanks for help.
My understanding is that when you create and run an action on a sprite, the action is added to
CCActionManager, which is a singleton that will manage the actions for you. This includes releasing all of them when theCCACtionManageritself is released and also when the action is done.This is the relevant code about the latter (from CCActionManager.m):
After doing some research, it seems that the topic of reusing and action is on shaky grounds. Anyway, you can read here what the cocos2d best practices suggest. IMO, I would not try and reuse an action…