0 votes

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:




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"
    $spr_player.animation = "Standing"

Thnx a lot.

in Engine by (26 points)

Where do you call get_node("spr_player").play("Charge")?

2 Answers

0 votes

Did you marke the loop checkbox for the animation?

by (156 points)
0 votes

I've already fix It.

I didn't know that the previous actions that I call affected the animation, I used the same code a few lines above and that did the trick, thnx a lot for your answers

by (26 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.