diff options
author | rom <romangraef@gmail.com> | 2021-04-26 13:44:11 +0200 |
---|---|---|
committer | rom <romangraef@gmail.com> | 2021-04-26 13:44:16 +0200 |
commit | 6bc98b0fd0ae2657409bd53b6317035a32a499bd (patch) | |
tree | 140fab0c01e02e3555b73e8907a33bd63fe9473c /scenes/levels/base_level.gd | |
parent | b66eb089dbce08f4d38df39f373718194febcb61 (diff) | |
download | ldjam48-6bc98b0fd0ae2657409bd53b6317035a32a499bd.tar.gz ldjam48-6bc98b0fd0ae2657409bd53b6317035a32a499bd.tar.bz2 ldjam48-6bc98b0fd0ae2657409bd53b6317035a32a499bd.zip |
base level loading improvements
TODO: get a boyfriend so i have something better to do than this
Diffstat (limited to 'scenes/levels/base_level.gd')
-rw-r--r-- | scenes/levels/base_level.gd | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd index df08a32..dc344e2 100644 --- a/scenes/levels/base_level.gd +++ b/scenes/levels/base_level.gd @@ -57,8 +57,17 @@ func _load_next_level(): _load_current_level() func _unload_current_level(): - pass - + _path_renderer.path = null + _camera.path = null + _loaded_level = null + for c in _level_holder.get_children(): + _delayed_delete(c) + _track.queue_free() + yield(get_tree(), "idle_frame") # todo animation here? post mortem + +func _delayed_delete(c): + yield(get_tree().create_timer(2.0), "timeout") + c.queue_free() func _load_current_level(): if _loaded_level != null: push_error("Tried to load level, while another level was already loaded.") @@ -83,6 +92,7 @@ func _on_MenuButton_on_click(): func _on_Camera2D_done(): print("Camera movement done") + _last_camera_location = $Camera2D.position _loaded_level.start() func _disable_input(node): |