Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | checharor |
Hello, i’ve just started learning to use Godot Engine an I love it, but i have a problem:
I want to play an animation when press a key, in this case the “Z” key but i just get the first frame of the animation played only and there are 4 frames on it, this is my code:
func _process(delta):
if Input.is_key_pressed(KEY_Z):
$spr_player.animation = "Charge"
i’ve tried different ways but always get only the first frame of the animation:
get_node("spr_player").play("Charge")
and
$spr_player.play("Charge")
I dont understand why doesn’t work because this ones work without problem:
if move.x != 0:
$spr_player.animation = "Run"
$spr_player.flip_h = move.x < 0
elif move.y < 0:
$spr_player.animation = "Jump"
elif move.y > 0:
$spr_player.animation = "Down"
else:
$spr_player.animation = "Standing"
Thnx a lot.
Where do you call get_node("spr_player").play("Charge")
?
MaaaxiKing | 2020-06-04 10:49