Godot Version
4.2.1
Question
Trying to get player animation to work and seemingly cannot. I used the code provided on the Godot docs with some slight modifications and the original and the modified code does not work. If I had any guess to why it does not work it would be that I have not called my animation correctly. But looking for any solution as to how to call my animation correctly yields no results. This is the docs page 2D sprite animation — Godot Engine (stable) documentation in English
And this is my code.
extends AnimatedSprite2D
@onready var anim = $AnimatedSprite2D
func _process(_delta):
if Input.is_action_just_pressed("move_down"):
anim.play("playerAnim")
elif Input.is_action_just_pressed("move_up"):
anim.play("up_walk")
elif Input.is_action_just_pressed("move_right"):
anim.play("right_walk")
elif Input.is_action_just_pressed("move_left"):
anim.play("left_walk")
else:
anim.play("idle")