timer increment

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

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 on_body_entered of the hourglass to detect the player
but I can not increase the time

:bust_in_silhouette: Reply From: TyTYctA

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

it didn’t work

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

CB | 2019-02-17 13:22

I created a countdown timer

onready var game_timer = get_node(“Score Counter/UI/Base/game_timer”)

func _process(delta):
time_label.set_text(str(int(game_timer.get_time_left())))

func _on_game_timer_timeout():
get_tree().change_scene(“res://scenes/game_over.tscn”)

func _on_time_body_entered(body):
if “player” in body.name:
$game _ timer.wait_time += 10
queue_free()

CB | 2019-02-17 13:24

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

TyTYctA | 2019-02-19 06:48