How to make the animation play completely with one button?

Godot 4

Hello, everyone, I am a beginner. I would like to ask the great gods what method I should use to make this animation play completely. After I press the E key, that is, I set the “interact”, it always plays the animation again at the first frame.

The picture is below, with my code and picture. I want to know what method I should use. Thank you.


I have no idea what you want to happen. play(“gouhou”) will play the animation the way it is defined in the animation. So you’re saying playing from the beginning is bad? Or playing completely is bad? Do you want it to repeat, or…?

1 Like

do this:

if animated_sprite.animation_finished:
   animated_sprite.play("gouhou")

but normally seen your code is right. there is something wrong with the animation i think

1 Like

My friend, thank you for your answer. Maybe I can make the game simpler and don’t have to be so hard on myself. After all, I’m just a beginner and I shouldn’t bring myself anxiety.

Thank you for your answer. Maybe I shouldn’t make the game too complicated. After all, I’m just a beginner. If there are still some simple things that are a big problem for me in the future, I hope you can answer them. :smiling_face_with_three_hearts:

You’re welcome, but if you dont understand how it works

if animated_sprite.animation_finished:

the game will use the codeanimated_sprite.play("gouhou") only if the animation of the animatedSprite is finished