Stopping one state from accessing another.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chevi

So I have my character animation set up with a State Machine in the animation tree. I want to lock my movement when I’m in the “Run” state.
Some things to note:

  • I can achieve this with an “if” statement in front of the “run” input checking if I’m attacking at the moment. I don’t like this solution because I have to add every action that should stop the run.

  • I’m using “Move and Slide” for my movement, And “Move And Collide” for my gravity

In short, I’m trying to stop my character from running when I’m in the “Attack” state.

:bust_in_silhouette: Reply From: Mrpaolosarino

Try to add booleans like is_attacking etc. And then add the is_attacking to another condition in your running.