I'm new to Godot, and I wanted to learn how to use the AnimationPlayer node. I created an animation and could make it play automatically via scripting, but whenever I try to code it so it starts when I press a button, nothing happens. Please help.
extends Area2D
func _ready():
if Input.is_action_pressed("swing"):
get_node("anim").play("attack")
Note: I couldn't get indents to show so I just used underscores.