diff --git a/main.py b/main.py index 840dfae..aa61a3e 100644 --- a/main.py +++ b/main.py @@ -46,7 +46,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): freeze = False #Gameplay is freezed in certain situations while running: - screen.fill('#000000') + screen.fill((0,0,0)) events = pygame.event.get() for event in events: if event.type == pygame.QUIT: @@ -64,7 +64,7 @@ def play(screen, clock, running, background, isblack, WIDTH, HEIGHT): if not freeze: for thing in objects[0]: 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) 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): objects = [] - objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2, 160, 64, '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, 'medieval', 48, "Exit game", quitGame)) + 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, 'textbox.png', 'medieval', 48, "Options", uwu)) + objects.append(Button(WIDTH / 2 - 80, HEIGHT / 2 + 72, 160, 64, 'textbox.png', 'medieval', 48, "Exit game", quitGame)) while running: for event in pygame.event.get(): 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 screen.blit(bg, (0, 0)) 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 pygame.display.flip() @@ -180,9 +180,9 @@ def main(): config = readConfig() screen, clock, running, isblack, background, objects = setUp(config["screen"]) 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, 160, 64, '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, "Play", play)) + #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, 'textbox.png', 'medieval', 48, "Exit game", quitGame)) menu(screen, clock, running, background, isblack, WIDTH, HEIGHT) test(screen, clock, running, background, isblack, WIDTH, HEIGHT)