From 7b12cc1467c17694dfc6c1cef807fbb8c1b7f234 Mon Sep 17 00:00:00 2001 From: bleeptrack Date: Tue, 12 Jan 2021 12:48:06 +0100 Subject: [PATCH] return to level menu after chapter is finished --- scenes/main.gd | 9 +++++++-- scenes/main.tscn | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scenes/main.gd b/scenes/main.gd index 1928177..0bc4c8c 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -124,8 +124,13 @@ func reload_level(): load_level(game.current_level) func load_next_level(): - game.current_level = (game.current_level + 1) % levels.chapters[game.current_chapter].levels.size() - load_level(game.current_level) + game.current_level += 1 + if game.current_level >= levels.chapters[game.current_chapter].levels.size(): + + back() + else: + load_level(game.current_level) + func show_win_status(win_states): var all_won = true diff --git a/scenes/main.tscn b/scenes/main.tscn index 5dde507..88a3f4c 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -179,9 +179,11 @@ size_flags_vertical = 3 margin_right = 633.0 margin_bottom = 60.0 rect_min_size = Vector2( 0, 60 ) +size_flags_vertical = 3 size_flags_stretch_ratio = 0.0 custom_fonts/normal_font = ExtResource( 7 ) text = "Level name here!" +fit_content_height = true __meta__ = { "_edit_use_anchors_": false }