NovemberGodotGame2024/novembergame/scripts/ui.gd

24 lines
708 B
GDScript

extends Control
@onready var health: Label = $VBoxContainer/HBoxContainer/MarginContainer/health
@onready var coins: Label = $VBoxContainer/HBoxContainer/MarginContainer2/coins
@onready var timer: Label = $VBoxContainer/HBoxContainer/MarginContainer3/timer
var tempCoinCount = 0
var tempCoinTotal = 0
func timerUpdate(amt):
timer.text = "Seconds : " + str(amt)
func healthUpdate(amt):
health.text = ("Heath : " + str(amt))
func coinsUpdate(amt, total):
print("Update the UI " +str(amt))
tempCoinCount = amt
tempCoinTotal = total
if coins:
coins.text = ("Coins: " + str(amt) + " of " + str(total))
func _ready() -> void:
coins.text = "Coins: " + str(tempCoinCount) + " of " + str(tempCoinTotal)