I have a problem using spritegroups in pygame. In my situation I have 2 spritegroups, one for humans, one for "infected". A human is represented by a blue circle:
image = pygame.Surface((32,32))
image.fill((255,255,255))
pygame.draw.circle(image,(0,0,255),(16,16),16)
image = image.convert()
image.set_colorkey((255,255,255))
An infected by a red one (same code, different color).
I update my spritegroups as follows:
self.humans.clear(self.screen, self.bg)
self.humans.update(time_passed)
self.humans.draw(self.screen)
self.infected.clear(self.screen, self.bg)
self.infected.update(time_passed)
self.infected.draw(self.screen)
Self.bg is defined:
self.bg = pygame.Surface((SCREEN_WIDTH, SCREEN_HEIGHT))
self.bg.fill((255,255,255))
self.bg.convert()
This all works, except that when a red circle overlaps with a blue one, you can see the white corners of the bounding box around the actual circle. Within a spritegroup it works, using the set_colorkey function. This does not happen with overlapping blue circles or overlapping red circles.
I tried adding a colorkey to self.bg but that did not work. Same for adding a colorkey to self.screen.