import pygame pygame.init() screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption("Win Condition") clock = pygame.time.Clock() BG = (15, 30, 50) WHITE = (255, 255, 255) YELLOW = (240, 200, 40) font_score = pygame.font.SysFont(None, 48) font_win = pygame.font.SysFont(None, 80) score = 0 WIN_SCORE = 10 running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.MOUSEBUTTONDOWN: if score < WIN_SCORE: score += 1 screen.fill(BG) if score >= WIN_SCORE: win_surf = font_win.render("You Win!", True, YELLOW) rect = win_surf.get_rect(center=(320, 240)) screen.blit(win_surf, rect) else: score_surf = font_score.render(f"Score: {score} / {WIN_SCORE}", True, WHITE) screen.blit(score_surf, (20, 20)) pygame.display.flip() clock.tick(60) pygame.quit()