Ali_RS
October 2, 2022, 4:07am
2
You can also put a call method at the beginning of the sequence to detect when it reached to the beginning.
But you should note this about how Sequence works:
One thing that was making me confused was the following scenario:
new TweenAnimation(
new Invert(Tweens.sequence(Tweens.callMethod(this, "method1"), ac.makeAction("Walk"), Tweens.callMethod(this, "method2")))
);
I was expecting it to result:
execution of Method2 -> reversed walk animation -> execution of Method1
but the actual result is:
execution of Method1 -> execution of Method2 -> reversed walk animation -> execution of Method1
The issue for sequences is that they will “catch up” to whatever time they were given. So if you give them the end time then they will perform everything up until that.
Often that’s what you want because many times sequences can only be run in one direction.
You should instead make a backwards sequence and invert just the “Walk”, I guess.
So as suggested above you can do it like this instead:
Tweens.sequence(invert(action), callMethod("doSomething");
and set speed = 1.
Note that Invert
tween is added recently and will be available in the next release so for now you can just copy-paste it from the master branch or else you can build the engine from the source.
2 Likes