![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | CreamyMemeys |
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.
You format the code by putting four spaces or by clicking the “Code Sample” button at the top of the input window. I’ll edit your post for you.
kidscancode | 2019-12-30 17:51