Callback after a particle effect has finished

Callback after a particle effect has finished
0.0 0


Hello. I need to execute a callback function after a particle effect is done. Currently I’m calling the same particle by resetting it’s system.

Is there a way to do this?



Call it from destructor. Use std::function to keep your callback, or something else.


Sorry didn’t get it? Where should I put the std::function? Do I need to subclass the Cocos2d-x particle class?-


Yes, you can subclass particle class, add std::function member variable and call it from destructor (don’t forget to check if function valid: if (_callback) callback();).