Reverse timer

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

How to create a timer that instead of tickingdown ticks up. I thought of doing a score system where every second it adds 1 to score but that doesn’t give me time as a minute

:bust_in_silhouette: Reply From: Andrew Wilkes

The timer tick should only be thought of as an internal timer event. What is displayed on the screen should be as a result of your code logic processing the data. You connect the time_out signal from the Timer node to your function that updates whatever variables and UI you want to update such as the current time and score.

:bust_in_silhouette: Reply From: antoniodev

You can use the delta value, make a variable called time and set it to 0, next in the func _process(delta) call time += delta, also you want dont want decimals so use the int method

var time = 0

func _process(delta):
time += delta

print(int(time))

And that is basically it, the time will move up, the print is just for visualization.

Also if you want to do it as score you can do

score = time

if alive:
time += delta
else:
time = time