summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Scenes/Crystal.gd1
-rw-r--r--Scenes/Dungeon.gd3
-rw-r--r--Scenes/Global.gd6
-rw-r--r--Scenes/UIController.gd4
4 files changed, 14 insertions, 0 deletions
diff --git a/Scenes/Crystal.gd b/Scenes/Crystal.gd
index 620cea5..8e3e82e 100644
--- a/Scenes/Crystal.gd
+++ b/Scenes/Crystal.gd
@@ -30,3 +30,4 @@ func cor_activate(args : Array):
yield(get_tree(), "idle_frame")
is_active = true
+ Global.active_crystals += 1
diff --git a/Scenes/Dungeon.gd b/Scenes/Dungeon.gd
index 331f081..cf23430 100644
--- a/Scenes/Dungeon.gd
+++ b/Scenes/Dungeon.gd
@@ -22,6 +22,9 @@ var tiles_floor = {}
func _ready():
randomize()
build_floor()
+
+ Global.active_crystals = 0
+ Global.max_crystals = get_tree().get_nodes_in_group("crystals").size()
func set_tile(entity, tile):
if not entities_tiles.has(entity):
diff --git a/Scenes/Global.gd b/Scenes/Global.gd
index 1a4c020..09c935a 100644
--- a/Scenes/Global.gd
+++ b/Scenes/Global.gd
@@ -5,6 +5,8 @@ onready var BONUS_TURNS_STAGE_FINISH = 10
onready var turns = STARTING_TURNS setget set_turns
onready var current_stage = 0 setget set_stage
+onready var active_crystals = 0 setget set_crystals
+onready var max_crystals = 0
signal update_ui
@@ -15,3 +17,7 @@ func set_turns(t):
func set_stage(s):
current_stage = s
emit_signal("update_ui")
+
+func set_crystals(c):
+ active_crystals = c
+ emit_signal("update_ui")
diff --git a/Scenes/UIController.gd b/Scenes/UIController.gd
index 02312d1..353c434 100644
--- a/Scenes/UIController.gd
+++ b/Scenes/UIController.gd
@@ -4,12 +4,16 @@ onready var main_camera = get_viewport().get_camera()
onready var ScoreParticle = preload("res://Scenes/ScoreParticle.tscn")
onready var particles = $Particles
+onready var activated_crystals
+
func _ready():
Global.connect("update_ui", self, "_on_update_ui")
+ yield(get_tree(),"idle_frame")
_on_update_ui()
func _on_update_ui():
$NumberOfTurns.text = "Turns left: %d" % Global.turns
+ $Objectives.text = "(%d/%d) Activate the crystals!" % [Global.active_crystals, Global.max_crystals]
func on_monster_killed(monster_pos, score):
for i in range(score):