Im new to pygame, working with sprites right now. My question is: how to determine if a sprite has been clicked? I want to do something when the sprite was pressed just like the button.
thank:)
[Changed]
thanks Steven. Also, is there a way to find out who the sprite that was clicked on is? Here is a sample code
boxes = pygame.sprite.Group()
for color, location in [([255, 0, 0], [0, 0]),
([0, 255, 0], [60, 60]),
([0, 0, 255], [120, 120])]:
boxes.add(UpDownBox(color, location)
for example, I click the sprite at location [0,0], the program should print its color or its location. Thanks again:)
unice source
share