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

Re: [pygame] shapes other than rects?




--- Jan Ekholm <chakie@infa.abo.fi> wrote:
> On Wed, 24 Jan 2001, Chris Armstrong wrote:
> 
> >I'd like to be able to have shapes other than
> rectangles in my game,
> >preferrably with the same functionality as rects
> (collision detection, etc).
> >Does anyone have any advice for me for creating
> such things? I realize
> >creating a base rect-like object would be quite
> processor intensive for
> >lots of calculations... I'm open to ideas. Thanks.
> 
> Maybe you could use a few smaller rects to
> approximate the shape you have?
> Instead of having one big rect that contains the
> whole weird shape, have a
> few smaller ones that contain it too. So, for a
> shape like this:
> 
>     ***
>     ***
>     *********
>     *********
> 
> you would *not* have a rect like this:
> 
>    +--------+
>    |        |
>    |        |
>    +--------+
> 
> but intstead a large one as normal that contains the
> blittable shape,
> but two smaller ones for the collision detection:
> 
>    +-+
>    | | 
>    +-+------+
>    +--------+
> 
> This would make the collision detection a two-step
> process, but as you
> still use rects it should be quite fast. This has
> not been tested
> though...
> 
>
--------------------+--------------------------------------------------------
> Jan 'Chakie' Ekholm |     Balrog New Media   
> http://www.balrog.fi/
>    Linux Inside     | I'm the blue screen of death,
> nobody hears your screams
> 
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices. 
http://auctions.yahoo.com/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org