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

Re: [pygame] Collision Detection



Guyon: Building on what Pete said... If you want to get more advanced,
you could make separate "body" and "turret" sprites for your tank, and
only detect collisions for the "body" sprite.  (this will help combat
the blank space beside the turret contributing to the collidable area of
your sprite)

On a related note...

I've used this strategy (carrying around a secondary, shrunken rect for
collisions of 'solid' objects) in all (3) of my pygame projects.  Does
anyone else think it's common enough to be built into PyGame in general?

maybe we could have an api to change a sprite's "solidRect" and add an 
argument to spritecollide?

spritecollide(sprite, group, dokill=0, rectType="PROPER|SOLID" )
where PROPER is a traditional rect of a sprite and SOLID is the
solidRect

my $.02

-- 
+-------------------------------------------------------------+
| Shandy Brown                               Digital Thinkery |
| shandy@geeky.net             http://www.digitalthinkery.com |
+-------------------------------------------------------------+

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