That effect is more that just a circle, there is a drawing effect applied when it is blit, and or the images are translucent. The color stacks up with overlapping circles, and they fade as they expand.
ripple_list = []
class Ripple:
def __init__(self, pos):
self.pos = pos
self.radius = 0
self.max_radius = 50
self.surf = pygame.Surface((self.max_radius*2, self.max_radius*2)
self.rect = self.surf.get_rect()
self.surf.fill((0,0,0))
self.surface.set_colorkey((0,0,0))
self.alpha = 255
self.surf.set_alpha(self.alpha)
self.color = (0, 0, 255)
self.fade = 2
self.growth_speed = 2
self.rect.center = self.pos
def update(self):
if self.radius < self.max_radius:
self.surf.fill((0,0,0))
pg.draw.circle(self.surf, self.color, (self.max_radius, self.max_radius), self.radius)
self.alpha -= self.fade
self.radius += self.growth_rate
else:
ripple_list.remove(self)
When you click, spawn a ripple with
ripple_list.append(Ripple(Your_mouse_pos))
. And each frame:
for r in ripple_list:
r.update()
for r in ripple_list:
your_game_window.blit(r.image, r.rect)
That will get you started.