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

Re: [pygame] Re: Hexagonal collision detection?



On Tue, Sep 15, 2009 at 12:05 PM, rygoody <rygoody@xxxxxxxxx> wrote:
> Where do I get at this polygonal collision detection? I cannot find it
> in the pygame docs.

It doesn't come with pygame, you'd need to search for it.  Here's a
page here about it:
    http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/


The color method is probably best - that way you can do collision with
any shape at all.


>
> On Sep 15, 3:30 am, René Dudfield <ren...@xxxxxxxxx> wrote:
>> You could use polygon collision detection.
>>
>> Also you could draw your hex each with a different color, and use that
>> as a collision surface.  For example, you drew your 1st hex as color
>> (0,0,1,255) then your 2nd as (0,0,2,255) etc.  That would probably be
>> fastest, as it's just a lookup table - pretty easy too.
>>
>> cheers,
>>
>>