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)