Es mas o menos esto lo que quieres?
Código Python:
Ver originalimport random
import pygame
from pygame.locals import *
width, height = 640, 480
pygame.init()
screen = pygame.display.set_mode((width, height))
clock = pygame.time.Clock()
done = 1
r = 30
l = random.sample([(x, y) for x in xrange(r, width-r, r) for y in xrange(r, height-r, r)], 5)
for i in l: pygame.draw.circle(screen, (0, 0, 255), i, r)
font = pygame.font.Font(None, 20)
text = font.render('ganaste', True, (0, 255, 0))
textRect = text.get_rect()
pygame.display.flip()
def distance(a, b):
return ( (a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) ) ** .5
while done:
screen.fill((0, 0, 0))
for e in pygame.event.get():
if e.type == QUIT: done = 0
if e.type == MOUSEBUTTONDOWN:
pos = pygame.mouse.get_pos()
for i in l[:]:
if distance(i, pos) < r:
textRect.center = i
screen.blit(text, textRect)
l.remove(i)
break
for i in l: pygame.draw.circle(screen, (0, 0, 255), i, r)
if not l:
done = 0
pygame.display.flip()
clock.tick(80)