(hopefully someone knows how to do this with either the current Animate action, or has a link to pre-existing code of an Action-derived custom animate class, or otherwise has an answer whereby you can just plug something in without thought and get it working)
Otherwise, here’s my quick thought(s):
It may be possible to do this with the various Action derived classes, but I’d recommend just doing your own animation. It’s not too terribly difficult. Just copy some of the code from CCAnimate.cpp. The other idea would be to derive a custom MyCustomAnimate.cpp and then more easily code in the reversing and associated calculations.
In this specific case you may be able to easily derive from Animate and add your own ‘reverse animation’ functionality without too much work. The key is to have a flag where you either add/sub the delta time based on whether reversed or not (
t = reversed ? t - dt : t + dt ) , or you determine the current frame index based on whether reserved (
curIndex = reversed ? nFrames - calculatedFrameIndex : calculatedFrameIndex ).
You can also write your own animation update code inside the game loop scheduled update or a given Node-derived entity’s class’s scheduled update method. Just use similar code as in Animate where it takes an
elapsedTime value and determines the
currentIndex from that. Then have a ‘run in reverse’ flag such that instead of adding
elapsedTime subtract it instead.
There are probably a hundred ways to do this. I often find, however, that people try to use the Action system for everything and while it’s a great set of functionality it’s limited and restricted and whenever you hit the limits you should almost always move into your custom coded and updated system usually by not-deriving from ActionInterval (or whichever).
Anyway, hope these non-concrete examples give you an idea of how to move forward.