JanGodotGame/scripts/ui.gd

32 lines
912 B
GDScript

extends Control
@onready var timer: Label = $VBoxContainer/HBoxContainer/MarginContainer3/timer
@onready var health: Label = $VBoxContainer/HBoxContainer/MarginContainer/health
@onready var coins: Label = $VBoxContainer/HBoxContainer/MarginContainer2/coins
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func timerUpdate(timeRemaining):
if timeRemaining <= 0:
timer.text = "OUT OF TIME"
else:
timer.text = "🕔: "+str(timeRemaining)
func healthUpdate(healthRemaining, healthMax):
if healthRemaining <= 0:
health.text = " 💀 💀 💀 💀 "
else:
health.text = (" ❤️: "+str(healthRemaining)+"/"+str(healthMax))
func coinsUpdate(collected, remaining):
coins.text = ("🪙: "+str(collected)+"/"+str(remaining)+" ")