# Chapter 35 try-this: click score. # # Each left mouse click increases a score counter. Display the score on # screen at (10, 10). When the score reaches 5, show a "Done!" message in # the centre of the window. # # Run with: python exercises/35/01-click-score.py import pygame pygame.init() screen = pygame.display.set_mode((800, 600)) pygame.display.set_caption("Click Score") clock = pygame.time.Clock() font = pygame.font.SysFont("arial", 28) score = 0 running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # TODO: on a left-button MOUSEBUTTONDOWN, add 1 to score screen.fill((20, 20, 40)) # TODO: render the score and blit it at (10, 10) # TODO: when score reaches 5, blit "Done!" in the centre of the window pygame.display.flip() clock.tick(60) pygame.quit()