Level selection background

main
Skyball2000 2023-03-29 17:52:46 +02:00
parent d39262c65e
commit c3d8b11b8d
3 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,3 @@
from abc import abstractmethod
import pygame.time
from level.Level import Level

View File

@ -26,7 +26,7 @@ class MainMenuScreenManager(ScreenManager):
size = CoordinateTransform.transform_screen_to_world(self.main_loop.window_size, self.main_loop.screen_transform)
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)
self.create_button("SCREEN SIZE", 640, 430, 20)
def create_button(self, name: str, x_position, y_position, font_size):
label = TextLabel(name, x_position, y_position, font_size, alignment="center")

View File

@ -23,6 +23,7 @@ BACKGROUND_IMAGES_UNSCALED = {
'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'),
'level_select': pygame.image.load('data/sprites/level_select_bg.png'),
}
BACKGROUND_IMAGES_SCALED = {
@ -30,6 +31,7 @@ BACKGROUND_IMAGES_SCALED = {
'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)),
'level_select': pygame.transform.scale(BACKGROUND_IMAGES_UNSCALED['level_select'], (1, 1)),
}
@ -180,6 +182,8 @@ class MainLoop:
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))
elif self.game_state == self.GAME_STATE_LEVEL_SELECTION:
self.screen.blit(BACKGROUND_IMAGES_SCALED['level_select'], (0, 0))
self.sprite_manager.draw(self.screen, self.screen_transform)
pygame.display.update()