Topic was automatically imported from the old Question2Answer platform.
Asked By
RetroDan007
Friends I want to have a label. Let it be 3 seconds that it shows: 3,2,1 and let it be with an interval of 1 second. Sorry if a silly question I couldn’t find something like that on Google. How could I do it? Tried with set_wait_time (1) but it doesn’t work for me
How about setting a Timer for 3 seconds, and then checking whether the time remaining is under a certain number?
func _process( _change: float ):
if countdown_timer.time_left < 1.0:
countdown_label.text = 1
elif countdown_timer.time_left < 2.0:
countdown_label.text = 2
# This is the last check since the loop would always evaluate to "true" on values below 3.0.
elif countdown_timer.time_left < 3.0:
countdown_label.text = 3
Also, be sure to set the Timer to one-shot.
Thanks for the reply. It would be possible for you to pass the project on to me. Please, I would like to analyze the code.`enter image description here
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Timer.wait_time = 4
$Timer.start()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
$Label.text = str(int($Timer.time_left))