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

Re: [pygame] Turnable rect: collision checking



Gerrit Holl wrote on 2003-06-10:

> colliderect would also be possible. The real problem, however,
> would occur when another rect is trying to check whether he
> collides with *me*. He would probably assume that I am an
> ordinary rect, and thus behave incorrectly. It this problem
> solvable? I don't know C so I am unable to read the source :(.
>
The best solution might be to follow the example of Python's operators
and define some "collision protocol".  So there would be a
`collides(a, b)` function that would first try ``a.collides(b)``
and then ``b.collides(a)``...

-- 
Beni Cherniavsky <cben@users.sf.net>

Premature classification is the superclass of all evil.