summaryrefslogtreecommitdiff
path: root/scenes/levels/base_level.gd
diff options
context:
space:
mode:
authorrom <romangraef@gmail.com>2021-04-25 18:59:28 +0200
committerrom <romangraef@gmail.com>2021-04-25 18:59:38 +0200
commit3e8e361c8c6b9a7d02361c2f72a20e5e41873052 (patch)
tree3b6dda00cf4566ffd30a8a6933e4d7c0f93da9e1 /scenes/levels/base_level.gd
parent86c8cf34d53290df113a97c051acade184e4f2f3 (diff)
downloadldjam48-3e8e361c8c6b9a7d02361c2f72a20e5e41873052.tar.gz
ldjam48-3e8e361c8c6b9a7d02361c2f72a20e5e41873052.tar.bz2
ldjam48-3e8e361c8c6b9a7d02361c2f72a20e5e41873052.zip
settings
Diffstat (limited to 'scenes/levels/base_level.gd')
-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.")