Require help starting Timer node.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alex951

I’m creating a simple counter that resets once it reaches it’s limit using a timer node but it doesn’t raise the counter. I have Autostart checked with a wait time of 2 but nothing is being done. Any idea what I’m doing wrong?

 extends Timer

var counter = null
const FULL = 5

#Begin
func _ready():
	print("start")
	pass

#Counter
func on_timeout():
	print(counter()/5)
	1 + counter
	pass
	
#Resets
func _process(delta):
	if counter == FULL:
		counter = 0
		print("reset")
	pass
:bust_in_silhouette: Reply From: picnic

I created a project with a timer and two labels then put this in a script attached to the timer, it shows the countdown and when it first times out. Notice the function on_Timer_timeout() - did you hook up the signal to go to this function?


extends Timer

func _ready():
    pass

func _process(delta):
    get_node("Label").text = str(time_left)

func _on_Timer_timeout():
    get_node("Label2").text = "Timed out" here

Thanks for your help! Haven’t looked into deep signals tab at all yet but I see now is the time to do so.

Alex951 | 2018-06-22 16:33