0 votes

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

Godot version 3.3
in Engine by (44 points)

2 Answers

0 votes

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.

by (175 points)
+1 vote

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

by (56 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.