   Pygame Masks
  I'm trying to use masks for collision detect, but the Mask.overlap function asks for the other mask and an offset.  I'm not understanding what the offset should be or is for.   
pygame.mask.Mask.overlapQuote: Returns the point of intersection if the masks overlap with the given offset - or None if it does not overlap.Mask.overlap(othermask, offset) -> x,yThe overlap tests uses the following offsets (which may be negative):   +----+----------..   |A   | yoffset   |  +-+----------..   +--|B   |xoffset   |  |   :  :User comment: "The offset is the vector from the top left corner of 'self' (A in the picture) to the top left corner of other_mask (B in the picture)."The offset is a 2-tuple, specifying the vector distance between the upper left corner of your existing mask and the upper left corner of the other mask you want to test collision against. For example, if you have two sprites with masks based on their bitmaps, you can use the difference between their coordinates as the offset.   ;  Here's a snippet of collision code: if ship.mask.overlap(planet.mask, (ship.x - planet.x, ship.y - planet.y)):  endgameLabel.text = "Planet Collision!"It seems to generate a collision message even when my ship sprite is far inside of the planet sprite.Also, do I have to generate a new mask when I rotate the ship sprite?   ;Quote:Original post by EsysIt seems to generate a collision message even when my ship sprite is far inside of the planet sprite.Yes, it will generate a collision message for any overlap of the two sprites.Quote:Also, do I have to generate a new mask when I rotate the ship sprite?Yes.   ;  Seems I need to work on it, but I've found some PixelPerfectCollision programs in the pygame cookbook that work wonders.But thank you for the help.   