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

Re: [pygame] image collision



There are several different ways to do it. Since your question is so
vague, I'll assume that you want to know about rectangle collision,
though.

On Pygame, you got a very useful unit called pygame.rect (
http://www.pygame.org/docs/ref/rect.html ) which, in turn, has a class
called Rect, with a method called colliderect (
http://www.pygame.org/docs/ref/rect.html#Rect.colliderect )

Basically, it means that it is better to pass instances of Rect
whenever you're blitting (drawing) images on the screen, and using
those same instances of rect to verify if they are overlapping each
other through rect1.colliderect(rect2)

I hope that answers your question.

-Thiago


On Fri, Apr 11, 2008 at 7:24 PM, Jan Filip Tristan <blenderkid@xxxxxx> wrote:
> Hi,
>
>  How to check wheather two images collided?
>
>  TIA blenderkid
>
>