0 votes

anybody knows how to increment a timer?
in my main scene I have an accountant.
decreasing, when counter = 0 gives game over
, but during the game I have hourglasses that add more time to the timer
I used the onbodyentered of the hourglass to detect the player
but I can not increase the time

in Engine by (35 points)

1 Answer

0 votes

You can use proterty wait_time to increase time of Timer. $Timer.wait_time += 10.

by (312 points)
edited by

it didn't work

debugger message:
Invalid get index 'wait_time' (on base: 'null instance')

I created a countdown timer

onready var gametimer = getnode("Score Counter/UI/Base/game_timer")

func process(delta):
time
label.settext(str(int(gametimer.gettimeleft())))

func ongametimertimeout():
gettree().changescene("res://scenes/game_over.tscn")

func ontimebodyentered(body):
if "player" in body.name:
$game _ timer.waittime += 10
queue
free()

oh. I am sorry. it is $Timer.wait_time += 10

You can take all properties of node by holding mouse above that property

enter image description here

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.