You could use the animation_finished
signal and then change/stop the animation when it is finished. Something like this should work (untested):
extends Node2D
func _ready():
$AnimatedSprite.connect("animation_finished", self, "_on_AnimatedSprite_animation_finished")
$AnimatedSprite.play("blackout")
func _on_AnimatedSprite_animation_finished():
if $AnimatedSprite.animation == "blackout":
$AnimatedSprite.stop()
I think you can set whether an animation loops or not in the editor, but I haven't really used AnimateSprite nodes very much, so I'm not totally sure. It might be something to look into though. In this picture from the Godot documentation, there is a button called Loop
, which I think you can click to disable looping for AnimatedSprite nodes:

Regardless, the code above should cause the animation to only play once. Hopefully this helps :smile: