Kommentare hinzugefügt, die auskommentiert werden können, damit Hintergründe ausgetestet werden können.
parent
a8d0a9627c
commit
0853c04844
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
{
|
||||
"name": "level-01",
|
||||
"theme": "tutorial",
|
||||
"theme": "castle",
|
||||
"abilities": [
|
||||
],
|
||||
"file": "level-01.csv"
|
||||
|
|
|
@ -17,8 +17,15 @@ from ui_elements.KeyManager import KeyManager
|
|||
from ui_elements.LevelMenu import LevelMenu
|
||||
from ui_elements.TextLabel import TextLabel
|
||||
|
||||
what_to_run = 'menu'
|
||||
what_to_run = 'level'
|
||||
|
||||
WIDTH = 12 * 71 * 1.5
|
||||
HEIGHT = 12 * 40 * 1.5
|
||||
|
||||
# Background to test for level design
|
||||
# test_background_castle = pygame.transform.scale(pygame.image.load('data/sprites/castle_bg.png'), (WIDTH, HEIGHT))
|
||||
# test_background_cave = pygame.transform.scale(pygame.image.load('data/sprites/cave_bg.png'), (WIDTH, HEIGHT))
|
||||
# test_background_tutorial = pygame.transform.scale(pygame.image.load('data/sprites/tutorial_bg.png'), (WIDTH, HEIGHT))
|
||||
|
||||
def apply_frame_rate(number: float):
|
||||
"""
|
||||
|
@ -35,6 +42,7 @@ if what_to_run == 'menu':
|
|||
|
||||
screen_height = 12 * 40 * 1.5
|
||||
screen_width = 12 * 71 * 1.5
|
||||
|
||||
pygame.init()
|
||||
screen = pygame.display.set_mode((screen_width, screen_height))
|
||||
pygame.display.set_caption("PM GAME")
|
||||
|
@ -110,6 +118,7 @@ elif what_to_run == 'level':
|
|||
pygame.init()
|
||||
screen = pygame.display.set_mode((12 * ConstantsParser.CONFIG.level_size[0] * screen_transform.scale[0],
|
||||
12 * ConstantsParser.CONFIG.level_size[1] * screen_transform.scale[1]))
|
||||
|
||||
pygame.display.set_caption("PM GAME")
|
||||
clock = pygame.time.Clock()
|
||||
frame_rate = 30
|
||||
|
@ -133,6 +142,7 @@ elif what_to_run == 'level':
|
|||
|
||||
while True:
|
||||
clock.tick(frame_rate)
|
||||
|
||||
calculated_frame_rate_text.text = f"{round(clock.get_fps())} FPS"
|
||||
|
||||
pygame_events: list[pygame.event.Event] = pygame.event.get()
|
||||
|
@ -145,6 +155,8 @@ elif what_to_run == 'level':
|
|||
quit()
|
||||
|
||||
screen.fill((0, 0, 0))
|
||||
# Playground to test background on any level
|
||||
# screen.blit(test_background_castle, (0, 0))
|
||||
|
||||
sprite_manager.tick(TickData(apply_frame_rate(1), pygame_events, key_manager, click_events, screen_transform))
|
||||
sprite_manager.draw(screen, screen_transform)
|
||||
|
|
Loading…
Reference in New Issue