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.
myParticle~~>setVisible;
myParticle~~>setPosition(targetPosition);
myParticle->resetSystem();
Is there a way to do this?
Thanks.
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();
).