8D Top Down 2D movement attack direction help

So I’m creating a roguelite game where theres 8 directional movement. I currently have a 2D freeform directional blendtree that has animations for each direction for the idle and walk animations. I have implemented an attacking system that changes the players direction depending on where they click attack on the screen but currently while the player is attacking and walking backwards the legs still move as if the player is running forward. How do I make an animation system that can reverse the players legs while they are walking backwards? I would really appreciate any help. I have watched many guides and tutorials but none seem to have the same idea I want to. Thanks in advance!

Hi Rafaatrash!

To get an animation to play backwards, make sure you open up your animation controller and add a parameter called “Speed”. Once you do this, click on the state that makes your character walk in the animation controller and check true the parameter option next to Multiplier, then set it to your Speed varaiable. In code, when you want to play it reversed, make sure you have a reference to your animator and write this:

animator.SetFloat("Speed", -1);
animator.Play("Walk", -1, float.NegativeInfinity);

Below are images visualizing the steps to take:


Hope this helps!