# YOUR NAME HERE # Nov 8, 2012 # A program for clicking circles as fast as you can import pygame, random # define a function 'drawcircles' here that takes 'circlelist' as input # it should clear the screen, draw all the circles, # including a thin black outer ring, and flip the display # each list within 'circlelist' should have the format # [color1,color2,color3,xcoord,ycoord,dx,dy] # initialize variables count and circlelist here pygame.init() screen = pygame.display.set_mode([400,400]) screen.fill([255,255,255]) drawcircles(circlelist) pygame.time.delay(20) while count > 0: for event in pygame.event.get(): if event.type == pygame.MOUSEBUTTONDOWN: coords = pygame.mouse.get_pos() # the next portion of code checks for the uppermost # circle that was clicked, working backwards through list # if we find one, delete it and break out of for loop # this portion of code will update the x,y coords and # bounce the circles off the edges if necessary drawcircles(circlelist) pygame.time.delay(20) elapsed = pygame.time.get_ticks() font = pygame.font.Font(None, 50) line1 = "You finished the" line2 = "Click-It game in" line3 = str(elapsed/1000.0)+" seconds." text1 = font.render(line1, True, (50,150,255), (255,255,255)) text2 = font.render(line2, True, (50,150,255), (255,255,255)) text3 = font.render(line3, True, (50,150,255), (255,255,255)) screen.blit(text1, (50,100)) screen.blit(text2, (50,170)) screen.blit(text3, (50,240)) pygame.display.flip() raw_input("Press [ENTER] to close the Pygame window.") pygame.quit()