From 695b4ad6b12f1d924b25bf50333125ed2d52fe88 Mon Sep 17 00:00:00 2001 From: Fabian Hoppe Date: Wed, 29 Mar 2023 17:34:18 +0200 Subject: [PATCH] change name and add first version of start screen --- project/level/selection/MainMenuScreenManager.py | 4 ++-- project/main.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/project/level/selection/MainMenuScreenManager.py b/project/level/selection/MainMenuScreenManager.py index 1ec6627..af6117a 100644 --- a/project/level/selection/MainMenuScreenManager.py +++ b/project/level/selection/MainMenuScreenManager.py @@ -25,8 +25,8 @@ class MainMenuScreenManager(ScreenManager): def initialize(self): size = CoordinateTransform.transform_screen_to_world(self.main_loop.window_size, self.main_loop.screen_transform) - self.create_button("START", size[0] * 0.5, size[1] * 0.5, 70) - self.create_button("SCREEN SIZE", size[0] * 0.5, size[1] * 0.7, 40) + self.create_button("START", size[0] * 0.495, size[1] * 0.772, 38) + self.create_button("SCREEN SIZE", size[0] * 0.85, size[1] * 0.9, 20) def create_button(self, name: str, x_position, y_position, font_size): label = TextLabel(name, x_position, y_position, font_size, alignment="center") diff --git a/project/main.py b/project/main.py index 36633ff..db5d4be 100644 --- a/project/main.py +++ b/project/main.py @@ -22,12 +22,14 @@ BACKGROUND_IMAGES_UNSCALED = { 'tutorial': pygame.image.load('data/sprites/tutorial_bg.png'), 'castle': pygame.image.load('data/sprites/castle_bg.png'), 'cave': pygame.image.load('data/sprites/cave_bg.png'), + 'menu': pygame.image.load('data/sprites/intro_bg.png'), } BACKGROUND_IMAGES_SCALED = { 'tutorial': pygame.transform.scale(BACKGROUND_IMAGES_UNSCALED['tutorial'], (1, 1)), 'castle': pygame.transform.scale(BACKGROUND_IMAGES_UNSCALED['castle'], (1, 1)), 'cave': pygame.transform.scale(BACKGROUND_IMAGES_UNSCALED['cave'], (1, 1)), + 'menu': pygame.transform.scale(BACKGROUND_IMAGES_UNSCALED['menu'], (1, 1)), } @@ -53,7 +55,7 @@ class MainLoop: self.window_size: tuple[float, float] = (1, 1) pygame.init() - pygame.display.set_caption("PM GAME") + pygame.display.set_caption("Don't Get Busted") self.update_position_scale(self.screen_transform) @@ -176,6 +178,8 @@ class MainLoop: self.sprite_manager.tick(tick_data) 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)) + elif self.game_state == self.GAME_STATE_MENU: + self.screen.blit(BACKGROUND_IMAGES_SCALED['menu'], (0, 0)) self.sprite_manager.draw(self.screen, self.screen_transform) pygame.display.update()