How can I create direction-based animations?

hey, I’m wanting to make dynamic animations. What i mean is, well, when you walk backwards, a back-walk animation plays, or when you walk left a left-walk animation plays and yada yada you get the idea.

How should I go about this? Could I use inputChanged()?

Thank you in advance