How to implement the control and change of animations as in Undertale when the character moves?

How to implement the control and change of animations as in Undertale when the character moves?

The platformer example included in GDevelop demonstrates how player controls and animation states work.

The platformer behavior will help with the animation of 8 directions?