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

Re: [pygame] Game idea revised



On Thu, 01 Mar 2007 15:48:29 +1300
Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:

> No, "pixel perfect" usually means taking the actual shape
> of the object into account, i.e. comparing their bitmaps.
> This is obviously a lot more expensive than just comparing
> the bounding rects.
> 
> Rest assured that Python has no trouble doing integer
> arithmetic accurately, and will tell you for certain
> whether the bounding rects intersect or not. :-)
> 
> (If you were using floats for your rect coordinates,
> you might have some accuracy limitations, but that's
> a general feature of float arithmetic, and nothing to
> do with Python.)
> 

On Wed, 28 Feb 2007 18:27:42 -0800
"Bob Ippolito" <bob@xxxxxxxxxx> wrote:

> Pixel perfect detection typically means that you're actually comparing
> a bitmap mask of two sprites, to see if the actual pixels overlap.
> 
> Comparing rectangles or circles is a lot cheaper than individual
> pixels. You can check the pixels *after* you've found a collision in
> the rectangles (which means they're at least very close to touching
> visually), but usually you don't have to bother.
> 
> -bob


Thanks for clearing that up guys. I'll remember that.