Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Cakee |
I am showing a sprite and would like to have a coded way to make a sprite disappear after showing for five second without using animations.
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Cakee |
I am showing a sprite and would like to have a coded way to make a sprite disappear after showing for five second without using animations.
Reply From: | Nobledestus |
I’m new to Godot but I think you can use the timer node and use signal to connect it to the sprite. Then on the inspector increase wait to 5.
That’s it I think
Reply From: | JCNegar |
You can show the sprite start a timer then use the timer’s timeout signal
func on_timer_timeout():
$Sprite.visible = false
Reply From: | Ertain |
Have you looked into using a Timer
? Set the Timer
to “One shot”, then assign its timeout()
signal to some script (such as the sprite’s script). Set the signal function (the one that’s usually called _on_timer_timeout()
) to either hide the sprite, or free it completely. The function would look like this:
# In the sprite script.
func _on_timer_timeout():
# Either call this function or hide()
queue_free()