This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

Im not sure why but every time i tell Godot to play a Animation it only plays it when the button is held down instead of Press and Play the Animation from Start to Finish im still new to animations.

Can some one help me with what is going on, its pretty basic how the code works its like this:

if Input.is_action_pressed("X_Button"):
        anim_to_play = "Jump"

Thank you

Godot version 3.3.2
in Engine by (41 points)


is_action_pressed only returns true if you are currently pressing the button.

You want to use is_action_just_pressed, although I'm not sure if that would fix your issue because I don't know how you are handling your animation.

Can you share the part of your code that plays the animation?

(the code snippets are also hyperlinks to the docs)

Its pretty basic its mostly from AnimationPlayer

the code is this that i use:

var current_anim = anim_player.get_current_animation()
if current_anim != anim_to_play:

I did try the isactionjust_pressed but that one hardly plays the animation so im still not sure what to do

I ended up fixing the issue it turns out it needed "func _Input(event)" but now the issue is the animation wont stop playing and it now constantly loops. Any idea on how to stop the animation?

Make sure your animation isn't set to loop. (top right corner of the animation tab)
Also read this if you haven't already. This part talks a bit about looping animations.

None of the animations are using any form of looping what so ever if anything there is no actual sign of any looping going on it just loops.

Also something as simple as say Jump and play a jump animation does not even work properly at times the animation wont stop and in others it will not even play at all i had seen some tutorials but many of them dont really work on my end for some reason so im mostly spending hours trying to figure this out.

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.