NovemberGodotGame/fabigame/scripts/ui.gd

21 lines
640 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
var tempCoinTotal
func timerUpdate(amt):
timer.text = str(timer) + " s"
func healthUpdate(amt):
health.text=("Health: "+str(amt) )
func coinsUpdate(amt, total):
tempCoinCount = amt
tempCoinTotal = total
if coins:
coins.text = ("Coins: "+str(amt)+" / "+str(total) )
func _ready() -> void:
coins.text="Coins: "+str(tempCoinCount)+" / "+str(tempCoinTotal)