NovemberGodotGame2024/novembergame/scripts/ui.gd

24 lines
708 B
GDScript3
Raw Normal View History

2024-12-24 02:28:19 +00:00
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)