sep-pm-platformer/project/level/selection/LevelScreenManager.py

35 lines
1.2 KiB
Python
Raw Normal View History

from abc import abstractmethod
2023-03-29 13:50:48 +02:00
from level.Level import Level
from level.elements.LoadedLevel import LoadedLevel
from level.selection.ScreenManager import ScreenManager
from physics.SpriteManager import SpriteManager
2023-03-29 13:50:48 +02:00
from physics.TickData import TickData
from sprite.SpritesheetManager import SpritesheetManager
2023-03-29 13:50:48 +02:00
from ui_elements.KeyManager import KeyManager
class LevelScreenManager(ScreenManager):
2023-03-29 13:50:48 +02:00
def __init__(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager, main_loop,
level: Level):
super().__init__(sprite_manager, spritesheet_manager, main_loop)
2023-03-29 13:50:48 +02:00
self.level = level
self.loaded_level = LoadedLevel(sprite_manager, spritesheet_manager)
self.loaded_level.level_screen_manager = self
2023-03-29 13:50:48 +02:00
self.loaded_level.load_level(self.level)
def initialize(self):
pass
def destroy(self):
super().destroy()
2023-03-29 13:50:48 +02:00
self.loaded_level.destroy_level()
def tick(self, tick_data: TickData):
if tick_data.key_manager.is_keymap_down(KeyManager.KEY_ESCAPE):
self.main_loop.select_level_selection(self.level.theme)
def player_death(self):
self.main_loop.player_death(self.level)