Hello abbos,
I see your AnimationPlayer
has animations for idle
, jump
, punch
, run
, speed
. Previewing these from within the player, they all work.
However, in the script you use, only two states are actually ever executed.
if is_moving:
$AnimationPlayer.play("run")
else:
$AnimationPlayer.play("idle")
The following is a bit better, but the jump is still not that great here as (unlike the others), you don't want to interrupt it.
if $AnimationPlayer.get_current_animation() == "jump":
return
if gravity == jump:
$AnimationPlayer.play("jump")
elif is_moving:
if speed == sprint:
$AnimationPlayer.play("speed")
else:
$AnimationPlayer.play("run")
else:
$AnimationPlayer.play("idle")