From 7e7d0566e823b782114dba406e03a7d7f4aa5103 Mon Sep 17 00:00:00 2001 From: Irina Ternovaja Date: Mon, 19 Feb 2024 08:18:32 +0000 Subject: [PATCH] Upload files to "/" --- main.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 06cdd80..3d4322d 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,7 @@ def main(): icon = pygame.image.load("ICON.png") pygame.display.set_icon(icon) background = pygame.image.load("space.jpg") - background = pygame.transform.scale(background, (1000,700)) + # background = pygame.transform.scale(background, (1000,700)) hangar = pygame.image.load("HANGAR.jpg") @@ -49,9 +49,35 @@ def main(): running = True difficulty = 0 - + + def draw_text(text, font, text_col, x, y): + text = font.render(text, True, text_col) + screen.blit(text, (x, y)) while running: + match scene: + case "menu": + screen.blit(hangar, (0, 0)) #menu + if new_game_button.draw(screen): + scene = "game" + if difficulty_button.draw(screen): + scene = "difficulty" + if best_score_button.draw(screen): + scene = "best_score" + case "best_score": + screen.blit(hangar, (0, 0)) + print_best_score(best_score[difficulty]) + if back_button.draw(screen): + scene = "menu" + case "difficulty": + screen.blit(hangar, (0, 0)) + draw_text("Choose the difficulty", font, text_color, 350, 50) + for i in range(0, len(difficulty_buttons)): + if difficulty_buttons[i].draw(screen): + difficulty = i + scene = "menu" + if back_button.draw(screen): + scene = "menu" for event in pygame.event.get(): if event.type == pygame.QUIT: running = False