summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Alves <henriquelalves@gmail.com>2022-07-16 12:36:24 -0300
committerHenrique Alves <henriquelalves@gmail.com>2022-07-16 12:36:24 -0300
commit4e06d14ebd6a3e452fa190478c6b825bd81afd95 (patch)
tree2945acfe6f70ee5583ccde2bbf09a4752caf732e
parent3dba5ea169aff72152470f7ea3badc079b0d2fcb (diff)
downloadgamejam-gmtk-2022-4e06d14ebd6a3e452fa190478c6b825bd81afd95.tar.gz
gamejam-gmtk-2022-4e06d14ebd6a3e452fa190478c6b825bd81afd95.tar.bz2
gamejam-gmtk-2022-4e06d14ebd6a3e452fa190478c6b825bd81afd95.zip
Add global and UIController
-rw-r--r--Scenes/Global.gd12
-rw-r--r--Scenes/UIController.gd8
2 files changed, 20 insertions, 0 deletions
diff --git a/Scenes/Global.gd b/Scenes/Global.gd
new file mode 100644
index 0000000..4bef11b
--- /dev/null
+++ b/Scenes/Global.gd
@@ -0,0 +1,12 @@
+extends Node
+
+onready var STARTING_TURNS = 20
+onready var BONUS_TURNS_STAGE_FINISH = 10
+
+onready var turns = STARTING_TURNS setget set_turns
+
+signal update_ui
+
+func set_turns(t):
+ turns = t
+ emit_signal("update_ui")
diff --git a/Scenes/UIController.gd b/Scenes/UIController.gd
new file mode 100644
index 0000000..1599d03
--- /dev/null
+++ b/Scenes/UIController.gd
@@ -0,0 +1,8 @@
+extends CanvasLayer
+
+func _ready():
+ Global.connect("update_ui", self, "_on_update_ui")
+ _on_update_ui()
+
+func _on_update_ui():
+ $NumberOfTurns.text = "Number of turns: %d" % Global.turns