[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Turnable rect: collision checking



What I've done in the past is have multiple rects for a sprite.  One
would be it's proper Pygame Rect for blitting to the screen.  Others
might be rects for collisions or rects for attacks.

For the problem of turning sprites on various angles, I'd probably
precompute the graphics for the various angles a sprite could face, and
create a bunch of rects to approximate collisions

here's an example with the blue rect the "display" rect, and the red
rects the "collision" rects



On Tue, 2003-06-10 at 18:31, Gerrit Holl wrote:
> bob@threeoh.com wrote:
> > >I am also unable to set new attributes! How am I supposed to
> > >set the angle if I am not allowed to do so? How can I solve
> > >this problem?
> > 
> > It's easy, don't try and use Rect to represent rectangles that aren't 
> > aligned to the axes of your screen.  It can't do it.
> 
> Hm, is there a workaround for the sprites' rects' then?
> Sure anyone has done this before? Is it so uncommon?
> 
> yours,
> Gerrit.
-- 
+-------------------------------------------------------------+
| Shandy Brown                               Digital Thinkery |
| shandy@geeky.net             http://www.digitalthinkery.com |
+-------------------------------------------------------------+

Attachment: example.png
Description: PNG image