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

Re: [pygame] circle rect collision code... from irc.



Hey,

as Joe said: there are several bugs.
for example it will miss the collision of this setup:

circle:
  radius = 10
  x, y   = 10, 10

rect:
  x, y = 15, 5
  w, h = 10, 10

I hope that is correct (I just did the example in my head).
The circle should be next to the rect cutting the same side of the rect twice. The code only seems to check if the center of the circle is inside the rect or if any of the corners are inside the circle.

sincerely yours,
Lorenz


On Fri, 25 Mar 2011 11:40:59 +0000, Renà Dudfield <renesd@xxxxxxxxx> wrote:
Hi,

I think it's a circle rect collision function.


On Fri, Mar 25, 2011 at 11:30 AM, Joe Ranalli <jranalli@xxxxxxxxx> wrote:
Was there any background on the purpose of that code? It seems at a glance
like there's several bugs.

On Fri, Mar 25, 2011 at 4:39 AM, Renà Dudfield <renesd@xxxxxxxxx> wrote:

Hey,

I noticed someone on irc left some code... but they aren't on irc any
more, and I wasn't around when they mentioned the code.

The code is here:
 Âhttp://collabedit.com/exb5k

Want to discuss it here?



cya.