summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/Level.gd7
-rw-r--r--scenes/levels/base_level.gd4
-rw-r--r--scenes/levels/reactiontest.gd2
3 files changed, 10 insertions, 3 deletions
diff --git a/components/Level.gd b/components/Level.gd
index 94f918a..18965a8 100644
--- a/components/Level.gd
+++ b/components/Level.gd
@@ -1,7 +1,7 @@
extends Node2D
class_name Level
-signal lost_heart()
+signal lost_heart(instakill)
signal level_finished()
@@ -9,7 +9,10 @@ func start():
print("Level ", name, " starting.")
func lose_heart():
- emit_signal("lost_heart")
+ emit_signal("lost_heart", false)
+
+func lose_all_hearts():
+ emit_signal("lost_heart", true)
func finish_level():
emit_signal("level_finished")
diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd
index b53acf8..f712ba7 100644
--- a/scenes/levels/base_level.gd
+++ b/scenes/levels/base_level.gd
@@ -42,7 +42,9 @@ func _add_hooks():
func _on_Level_level_finished():
_load_next_level()
-func _on_Level_lost_heart():
+func _on_Level_lost_heart(instakill):
+ if instakill:
+ _health = 0
_health -= 1
if _health == 0:
pass # TODO: lose scenario
diff --git a/scenes/levels/reactiontest.gd b/scenes/levels/reactiontest.gd
index 50f5ce2..2038409 100644
--- a/scenes/levels/reactiontest.gd
+++ b/scenes/levels/reactiontest.gd
@@ -28,6 +28,8 @@ func _process(delta):
if running:
timer += delta
timer_label.text = str(_total_time() - timer)
+ if timer >= _total_time():
+ lose_all_hearts()
func _on_Any_button_click(btn_idx):
if btn_idx == sequence_index: