I’m new in godot and watching now tutorials. They’re understandable, but sometimes outdated, so I stuck with AnimationTree - nodes like this isn’t work properly (playing animation depending on state):
If you don’t plan to use advance conditions or expressions then you need to change the transition advance mode to Enabled and use an AnimationNodeStateMachinePlayback to travel to the different states in your state machine.
Connecting the End node would mean you want to exit the tree, which I think you do not want to if you have Idle/run loop.
As to why the animation is flickering - did you put conditions for the state transitions? What does the _animation_idle() contain for example? How do you set transitioning from one state to another?
func _player_state():
if Input.is_action_just_pressed("roll"):
return ROLL
if Input.is_action_just_pressed("attack"):
return ATTACK
if (_player_vector() == Vector2.ZERO):
return IDLE
else:
return MOVE
It’s not looks good but at least it works, thanks to the answer above.
Now I think how to make it so that during animation state machine returns proper state. And how to remember last vector, because now idle animation always facing left (_player_vector = (0, 0)):