Fixed background images in level selection
parent
f94f33d1bb
commit
e3927524c7
|
@ -27,4 +27,4 @@ class LevelScreenManager(ScreenManager):
|
||||||
|
|
||||||
def tick(self, tick_data: TickData):
|
def tick(self, tick_data: TickData):
|
||||||
if tick_data.key_manager.is_keymap_down(KeyManager.KEY_ESCAPE):
|
if tick_data.key_manager.is_keymap_down(KeyManager.KEY_ESCAPE):
|
||||||
self.main_loop.select_level_selection()
|
self.main_loop.select_level_selection(self.level.theme)
|
||||||
|
|
|
@ -92,8 +92,10 @@ class MainLoop:
|
||||||
self.level = level
|
self.level = level
|
||||||
self.set_game_state(self.GAME_STATE_LEVEL)
|
self.set_game_state(self.GAME_STATE_LEVEL)
|
||||||
|
|
||||||
def select_level_selection(self):
|
def select_level_selection(self, theme: str = 'tutorial'):
|
||||||
self.set_game_state(self.GAME_STATE_LEVEL_SELECTION)
|
self.set_game_state(self.GAME_STATE_LEVEL_SELECTION)
|
||||||
|
if self.screen_manager is not None and isinstance(self.screen_manager, LevelSelectionScreenManager):
|
||||||
|
self.screen_manager.select_theme(theme)
|
||||||
|
|
||||||
def set_game_state(self, game_state: str):
|
def set_game_state(self, game_state: str):
|
||||||
self.game_state = game_state
|
self.game_state = game_state
|
||||||
|
@ -148,7 +150,7 @@ class MainLoop:
|
||||||
|
|
||||||
self.screen_manager.tick(tick_data)
|
self.screen_manager.tick(tick_data)
|
||||||
self.sprite_manager.tick(tick_data)
|
self.sprite_manager.tick(tick_data)
|
||||||
if self.level is not None:
|
if self.level is not None and self.game_state == self.GAME_STATE_LEVEL:
|
||||||
self.screen.blit(BACKGROUND_IMAGES_SCALED[self.level.theme], (0, 0))
|
self.screen.blit(BACKGROUND_IMAGES_SCALED[self.level.theme], (0, 0))
|
||||||
self.sprite_manager.draw(self.screen, self.screen_transform)
|
self.sprite_manager.draw(self.screen, self.screen_transform)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue