I’m new to cocos2d and to iphone development at all. I want to create some animation, when some physical object with it’s sprite is destroyed (for example to show a splash). And i want to to make some object i will say to: run the animation and destroy yourself when done. Then i want to forget about this object – it should be destroyed automatically when animation is finished. What is the best way to do it?
Share
You can use CCSequence to create a list of actions. The first action you do should be your regular action (or sequence). The second action should be CCCallFuncND action, where you can call a cleanup function and pass the given sprite.
Off the top of my head I’d do something like this:
and in the cleanup function:
You could add in another action between these two actions as well for your destroy particle actions instead of calling that in the end function.