- Joined
- Jan 11, 2009
- Messages
- 3,414
Hi everyone!
I noticed a strange thing when i was trying to play an animation backwards through triggers by doing this:
The animation only plays to it's first frame, then it stops. In other words, while forwards animations loop when they reach the end, playing it backwards would have it stop on the first frame where it should loop back to the last frame.
How do you solve this? I know it is possible, since i have seen it done in Combat Zone and other maps (hell, i even checked the source code for CZ, and it seemed to be done just like this!).
Here is a snippet of how it was made in CZ:
where "speed" is the speed squared and "r" is a real value that varies between units (can be anything between 0.1 and 0.3).
So, in short, how do you play animations backwards?
I noticed a strange thing when i was trying to play an animation backwards through triggers by doing this:
JASS:
call SetUnitTimeScale(u, -1)
The animation only plays to it's first frame, then it stops. In other words, while forwards animations loop when they reach the end, playing it backwards would have it stop on the first frame where it should loop back to the last frame.
How do you solve this? I know it is possible, since i have seen it done in Combat Zone and other maps (hell, i even checked the source code for CZ, and it seemed to be done just like this!).
Here is a snippet of how it was made in CZ:
JASS:
if MovingBackWards then
call SetUnitTimeScale( Obj, -SquareRoot(Speed)*r )
else
call SetUnitTimeScale( Obj, SquareRoot(Speed)*r )
endif
where "speed" is the speed squared and "r" is a real value that varies between units (can be anything between 0.1 and 0.3).
So, in short, how do you play animations backwards?