I check collision:
offset = (x0 - x1, y0 - y1)
result = player1.mask.overlap(player2, offset)
Its working between two images.
But if I want to check collision between a image and pygame.draw.line(...)
(I use it for create mask from line). mask.overlap
returns None
:
surface = self.gameDisplay.subsurface(pygame.draw.line(self.gameDisplay, colors.GREEN, [100, 100], [200, 200], 5))
line_mask = pygame.mask.from_surface(surface)
pygame.draw.line(self.gameDisplay, colors.GREEN, [100, 100], [200, 200], 5)
offset = (x0 - x1, y0 - y1)
result = player1.mask.overlap(mask, offset)
Sorry for my english.