feat(*): Add hud with timer

This commit is contained in:
Josh Creek
2025-07-13 18:36:48 +01:00
parent bdd0244873
commit 5ad381cf2f
7 changed files with 66 additions and 23 deletions
+23
View File
@@ -0,0 +1,23 @@
extends Node3D
@onready var game_timer: Timer = get_node("Timer")
signal timer_updated(minutes: int, seconds: int)
func _ready():
# Set timer to 2 minutes 30 seconds (150 seconds)
game_timer.wait_time = 150.0
game_timer.one_shot = true # Timer runs once
game_timer.start()
func _process(_delta):
if game_timer.time_left > 0:
var time_left = game_timer.time_left
var minutes = int(time_left) / 60
var seconds = int(time_left) % 60
timer_updated.emit(minutes, seconds)
else:
print("Timer finished!")
func _on_timer_timeout() -> void:
if game_timer.time_left == 0:
get_tree().change_scene_to_file("res://scenes/main_menu.tscn")