How to play animations backwards when using both AnimationTree and AnimatedSprite2D

Godot Version

v4.3-stable

Question

Hi, I’m trying to replicate player movement similar to games like Nuclear Throne, where player is always looking at the cursor while being able to move independently. So isometric 16 direction 2d game.

As of now I can move the player and look at the mouse properly while correctly playing the animations when moving/idling, the issue is that the running animation only plays in a forward manner but I need to play it either forward or backward depending on the player position relative to the cursor.

Here’s a GIF to better illustrate what I’m doing

The set up I have consists of:

  • AnimatedSprite2D: contains all the sprite frames for animations the player can do (idle and run, in 16 directions each)
  • AnimationPlayer: controls which animation the AnimatedSprite2D renders through two tracks
    • animation
    • frame
  • AnimationTree: has a state machine as root node with two BlendSpace2D nodes (Idle, Run)

I’ve tried to call play_backwards() or change speed_scale on both the AnimatedSprite2D and AnimationTree with no success.

Am I approaching this the wrong way? What would a possible solution for this looks like?