1while ... # your main loop
2 # get all events
3 ev = pygame.event.get()
4
5 # proceed events
6 for event in ev:
7
8 # handle MOUSEBUTTONUP
9 if event.type == pygame.MOUSEBUTTONUP:
10 pos = pygame.mouse.get_pos()
11
12 # get a list of all sprites that are under the mouse cursor
13 clicked_sprites = [s for s in sprites if s.rect.collidepoint(pos)]
14 # do something with the clicked sprites...
1while ... # your main loop
2 # get all events
3 ev = pygame.event.get()
4
5 # proceed events
6 for event in ev:
7
8 # handle MOUSEBUTTONUP
9 if event.type == pygame.MOUSEBUTTONUP:
10 pos = pygame.mouse.get_pos()
11
12 # get a list of all sprites that are under the mouse cursor
13 clicked_sprites = [s for s in sprites if s.rect.collidepoint(pos)]
14 # do something with the clicked sprites...
15