How to manage animations by using animation_tree rather than animation player?

Godot Version

4.5

Question

I have doubt about how to run animation when player presses certain key (for example jumping when enter key is pressed) ?? before when i waas using animation player I had just to call the play method: for istance:
anim_Sprite2D.play(“JUMP”)

You’re going to want to check out some tutorials on that. It’s not hard once you learn it, but it’s a lot to type. This is a pretty solid tutorial: https://www.youtube.com/watch?v=WrMORzl3g1U&pp=0gcJCdgAo7VqN5tD

1 Like

A similar line could be done using .travel on the state machine’s playback.

var animation_playback: AnimationNodeStateMachinePlayback = $AnimationTree["parameters/playback"]
animation_playback.travel("JUMP")