summaryrefslogtreecommitdiff
path: root/scenes/levels
diff options
context:
space:
mode:
Diffstat (limited to 'scenes/levels')
-rw-r--r--scenes/levels/base_level.gd12
1 files changed, 11 insertions, 1 deletions
diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd
index 9a2a618..d3a17a6 100644
--- a/scenes/levels/base_level.gd
+++ b/scenes/levels/base_level.gd
@@ -39,7 +39,7 @@ func _add_hooks():
_loaded_level.connect("lost_heart", self, "_on_Level_lost_heart")
func _on_Level_level_finished():
- pass # TODO
+ _load_next_level()
func _on_Level_lost_heart():
_health -= 1
@@ -47,6 +47,16 @@ func _on_Level_lost_heart():
pass # TODO: lose scenario
_health_bar.set_health(_health)
+func _load_next_level():
+ _unload_current_level()
+ _current_level += 1
+ if _current_level > _levels.size():
+ get_tree().change_scene("res://scenes/menu.tscn")
+ _load_current_level()
+
+func _unload_current_level():
+ pass
+
func _load_current_level():
if _loaded_level != null:
push_error("Tried to load level, while another level was already loaded.")