PixelPerfect v1.0

A simple pure python implementation of an pixel perfect collision detection algorithm.

Example Instructions

When starting the example 200 sprites is added to the screen at random locations. You can then move a larger blue sprite around by using the arrow keys or by using the mouse. Press spacebar to toggle between the pixelperfect-algorithm and the regular rectangle based one.

Whenever a hit is detect it is indicated by the BOOOM! text.

Screenshot

Related links

  • Python - The python programming language.
  • PyGame - Game development for Python.

Downloads

Known bugs!

There is a bug in the current PyGame release that prevents this example from working. But if you check out the latest PyGame version from CVS it should work just fine!

There is also a workaround to this bug. You have to do a double unlock() after the using pygame.surfarray.array_colorkey() method on an image.

No License

Both the PixelPerfect implementation and the example code is public domain.


Comment this project:

Your name:
Your email (hidden):
Message:
Enter the validation code :
Private! (visible for webmaster only)

Eluem 2009-01-19 01:55:35

It doesn't seem to work for me... it still gives me this error:

NotImplementedError: surfarray module not available

I really wanted to test this out...

Anonymous 2007-08-14 15:52:55

Elliot:

You should download WinImp. It's free and it extracts gzip, .gz, .rar,
and a bunch of other ones. I think I got it here:

http://www.simtel.net/product.download.mirrors.php?id=61817

Click the 'Worldwide Content Distribution' link and it will start downloading
in a few seconds.

Anonymous 2007-08-09 19:40:16

PLEASE RELEASE A ZIP DOWNLOAD!!!!! I can't extract .tgz files and it's driving
me CRAZY!!!! I really need some perfect collision detection for my Asteroids game
and this should work PERFECT!

HanClinto 2007-04-13 21:03:46

Fantastic project! I just found this today, and it works really well. I really appreciate you putting this together.

Do you think it's worthwhile to try and patch something like this into the main PyGame source tree? You seem to have done it with a very intuitive interface that works well with the existing PyGame model.

Elliott 2006-08-04 20:44:48

Sorry for inexperience, but I can't figure some things out...

I am on Windows XP and wanted to try PixelPerfect, but I can't find out how to uncompress the source code. Windows doesn't seem to know how to unzip it, and neither do I.
Python has a gzip module, but I don't know how to use it...

So if you could help me, I would apreciate it a lot!

Answer:

I'm not sure but I belive you can download WinRar. It's a comercial product but you can domnload an evaluation copy.

View all