extends Control export var healthBar_path : NodePath onready var healthBar = get_node(healthBar_path) export var goldText_path : NodePath onready var goldText = get_node(goldText_path) # called when we take damage func update_health_bar (curHp, maxHp): fetch_components() healthBar.value = (100 / maxHp) * curHp # called when our gold changes func update_gold_text (gold): fetch_components() goldText.text = "Gold: " + str(gold) func fetch_components(): if healthBar == null: healthBar = get_node("HealthBar") if goldText == null: goldText = get_node("GoldText")