Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
ac1a7fe73a Dateien nach "/" hochladen 2024-03-04 13:30:24 +00:00

18
main.py
View file

@ -46,7 +46,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT):
freeze = False #Gameplay is freezed in certain situations freeze = False #Gameplay is freezed in certain situations
while running: while running:
screen.fill('#000000') screen.fill((0,0,0))
events = pygame.event.get() events = pygame.event.get()
for event in events: for event in events:
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
@ -64,7 +64,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT):
if not freeze: if not freeze:
for thing in objects[0]: for thing in objects[0]:
thing.book.hidden = not freeze thing.book.hidden = not freeze
if not thing.update(pygame.key.get_pressed(), objects): if not thing.update(pygame.key.get_pressed(), pygame.mouse.get_pos(), objects):
menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) menu(screen, clock, running, background, isblack, WIDTH, HEIGHT)
thing.draw(screen) thing.draw(screen)
@ -127,9 +127,9 @@ def options(screen, clock, running, background, isblack, WIDTH, HEIGHT):
def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT): def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT):
objects = [] objects = []
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Play", play)) objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'textbox.png', 'medieval', 48, "Play", play))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Options", uwu)) #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'textbox.png', 'medieval', 48, "Options", uwu))
objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame)) objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'textbox.png', 'medieval', 48, "Exit game", quitGame))
while running: while running:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
@ -142,7 +142,7 @@ def menu(screen, clock, running, background, isblack, WIDTH, HEIGHT):
# fill the screen with an image to clear the screen # fill the screen with an image to clear the screen
screen.blit(bg, (0, 0)) screen.blit(bg, (0, 0))
for obj in objects: for obj in objects:
obj.process(screen, clock, running, background, isblack, WIDTH, HEIGHT) obj.update(screen, clock, running, background, isblack, WIDTH, HEIGHT)
# flip() the display to put your work on screen # flip() the display to put your work on screen
pygame.display.flip() pygame.display.flip()
@ -180,9 +180,9 @@ def main():
config = readConfig() config = readConfig()
screen, clock, running, isblack, background, objects = setUp(config["screen"]) screen, clock, running, isblack, background, objects = setUp(config["screen"])
WIDTH, HEIGHT = screen.get_size() WIDTH, HEIGHT = screen.get_size()
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'medieval', 48, "Play", play)) #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 - 72, 160, 64, 'textbox.png', 'medieval', 48, "Play", play))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'medieval', 48, "Options", uwu)) #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, 'textbox.png', 'medieval', 48, "Options", uwu))
#objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'medieval', 48, "Exit game", quitGame)) #objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'textbox.png', 'medieval', 48, "Exit game", quitGame))
menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) menu(screen, clock, running, background, isblack, WIDTH, HEIGHT)
test(screen, clock, running, background, isblack, WIDTH, HEIGHT) test(screen, clock, running, background, isblack, WIDTH, HEIGHT)