[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Collision detection revisited



 
> Mask(surface, rect=None): new Mask object
> Mask.get_size(): width, height
> Mask.draw(surface, pos): Rect of drawn area
looks fine

> Mask.get_at(pos): boolean of value at coords
I suggest set_at(pos) and clear_at(pos) also (bloat?).

> Mask.shrink(): maybe later?
> Mask.grow(): maybe later?
I'll fix these soon. I think they are userful to fine-tune 
the playability (maybe to shink the 'hero' mask or something).

> overlap(mask1, pos1, mask2, pos2): boolean if intersect
> overlap_area(mask1, pos1, mask2, pos2): number of overlapping pixels
I suggest overlap_pos(mask1, pos1, mask2, pos2): position also.

> how does that look? perhaps the "overlap" functions could actually
be 
> methods of the Mask object? let me know if you're thinking this will
fly?

Looks nice. I think the "overlap" functions should be methods of the
Mask object?

Earlier I was thinking of

class MaskedSurface(Surface)
...

to integrate more transparently with existing code, but that 
would of course be less flexible.

Please tell me about any changes I can make to the code to make you
life easier.

--Ulf


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org