From 14a057cbbab9cf6f2bde1feba9861166cb19afc9 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 28 Mar 2023 12:45:22 +0200 Subject: [PATCH] load selected level --- project/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/project/main.py b/project/main.py index 1dfb498..97b2a9a 100644 --- a/project/main.py +++ b/project/main.py @@ -53,8 +53,12 @@ if what_to_run == 'menu': level_menu_width = screen_width / 2 level_menu_height = screen_height / 2 level_menu = LevelMenu(parsed_levels_manager.levels, 0, 0, level_menu_width, level_menu_height, 3) - level_menu.level_select_listener = lambda selected_level: print(selected_level.name, "selected") - # generated_level.load_level(selected_level) + + def load_next_level(selected_level): + generated_level.destroy_level() + generated_level.load_level(selected_level) + + level_menu.level_select_listener = lambda selected_level: load_next_level(selected_level) for level_text_label in level_menu.level_text_labels: sprite_manager.add_ui_element(DrawLayers.UI, level_text_label)