summaryrefslogtreecommitdiff
path: root/scripts/morale.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/morale.gd')
-rw-r--r--scripts/morale.gd11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/morale.gd b/scripts/morale.gd
new file mode 100644
index 0000000..d5a8046
--- /dev/null
+++ b/scripts/morale.gd
@@ -0,0 +1,11 @@
+extends Label
+
+func _ready():
+ GameData.connect("morale_changed", Callable(self, "_on_morale_changed"))
+ update_label(GameData.get_morale())
+
+func _on_life_changed(new_morale: int) -> void:
+ update_label(new_morale)
+
+func update_label(new_morale: int) -> void:
+ text = "Morale:" + str(new_morale)