kaplay
kaplay copied to clipboard
feat: Reverse opt for Sprite.play()
Pingpong makes it so the animation plays back and forth, (forwards and then backwards), but theres no way to just reverse an animation quickly
You should be able to reverse an animation
An additional option for the Sprite.play() function (reverse: maybe?) that just reverses the animation
Not sure theres any other way this would be possible without making another animation
Another possible interface for backwards-playing of animations: setting theSprite.animSpeed to a negative number.
Currently I have this code in my game:
player.onStateUpdate("climbing", () => {
if (shouldMoveUp()) {
player.animSpeed = 1;
} else if (shouldMoveDown()) {
player.animSpeed = /* -1 */ 1;
} else {
player.animSpeed = 0;
}
});
I would love to be able to set the animSpeed to -1 so that the animation runs backwards when the player is moving backwards, but the value is currently clamped to 0 and the animation doesn't run (which looks wrong) or I have to set it to +1 which looks even worse.