# Homework 33, challenge: mouse follower. # # Draw a small circle at the current mouse position every frame so it # follows the cursor. When the left mouse button is held (check # pygame.MOUSEBUTTONDOWN and MOUSEBUTTONUP to track a held state), change # the circle's colour. # # Run with: python exercises/33/homework/04-mouse-follower.py import pygame pygame.init() screen = pygame.display.set_mode((800, 600)) pygame.display.set_caption("Mouse Follower") clock = pygame.time.Clock() running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # TODO: track whether the left button is held screen.fill((30, 30, 30)) # TODO: draw the circle at pygame.mouse.get_pos() in the right colour pygame.display.flip() clock.tick(60) pygame.quit()