Added back to level selection on all screens
parent
695b4ad6b1
commit
6c3918fd8b
|
@ -5,10 +5,11 @@ import pygame.time
|
|||
from level.Level import Level
|
||||
from level.elements.LoadedLevel import LoadedLevel
|
||||
from level.selection.ScreenManager import ScreenManager
|
||||
from physics.SpriteManager import SpriteManager
|
||||
from physics.SpriteManager import SpriteManager, DrawLayers
|
||||
from physics.TickData import TickData
|
||||
from sprite.SpritesheetManager import SpritesheetManager
|
||||
from ui_elements.KeyManager import KeyManager
|
||||
from ui_elements.TextLabel import TextLabel
|
||||
|
||||
|
||||
class LevelScreenManager(ScreenManager):
|
||||
|
@ -21,6 +22,11 @@ class LevelScreenManager(ScreenManager):
|
|||
self.loaded_level.level_screen_manager = self
|
||||
self.loaded_level.load_level(self.level)
|
||||
|
||||
self.back_button = TextLabel('BACK [ESC]', 635, 460, font_size=30)
|
||||
self.back_button.position_scale.scale = (0.5, 0.5)
|
||||
self.add_element(DrawLayers.UI, self.back_button)
|
||||
self.back_button.add_click_listener(lambda click: self.back_to_level_selection())
|
||||
|
||||
def initialize(self):
|
||||
pass
|
||||
|
||||
|
@ -30,8 +36,11 @@ class LevelScreenManager(ScreenManager):
|
|||
|
||||
def tick(self, tick_data: TickData):
|
||||
if tick_data.key_manager.is_keymap_down(KeyManager.KEY_ESCAPE):
|
||||
self.back_to_level_selection()
|
||||
pygame.time.delay(250)
|
||||
|
||||
def back_to_level_selection(self):
|
||||
self.main_loop.select_level_selection(self.level.theme)
|
||||
pygame.time.delay(200)
|
||||
|
||||
def player_death(self):
|
||||
self.main_loop.player_death(self.level)
|
||||
|
|
|
@ -64,6 +64,11 @@ class LevelSelectionScreenManager(ScreenManager):
|
|||
self.theme_label.position_scale.scale = (0.5, 0.5)
|
||||
self.add_element(DrawLayers.UI, self.theme_label)
|
||||
|
||||
self.back_button = TextLabel('BACK [ESC]', 610, 430, font_size=30)
|
||||
self.back_button.position_scale.scale = (0.5, 0.5)
|
||||
self.add_element(DrawLayers.UI, self.back_button)
|
||||
self.back_button.add_click_listener(lambda click: self.main_loop.select_main_menu())
|
||||
|
||||
for i in range(0, LABEL_COUNT):
|
||||
label = TextLabel(str(i), OFFSET[0] + 30, OFFSET[1] + 60 + i * 50, font_size=65)
|
||||
label.position_scale.scale = (0.5, 0.5)
|
||||
|
|
|
@ -18,6 +18,11 @@ class OptionsScreenManager(ScreenManager):
|
|||
label.position_scale.scale = (1, 1)
|
||||
self.create_button(name, label)
|
||||
|
||||
self.back_button = TextLabel('BACK [ESC]', 610, 430, font_size=30)
|
||||
self.back_button.position_scale.scale = (0.5, 0.5)
|
||||
self.add_element(DrawLayers.UI, self.back_button)
|
||||
self.back_button.add_click_listener(lambda click: self.main_loop.select_main_menu())
|
||||
|
||||
def create_button(self, name: str, label: TextLabel):
|
||||
if name == "SMALL":
|
||||
label.add_click_listener(lambda click: self.make_small_screen(click))
|
||||
|
|
Loading…
Reference in New Issue