Sprite collision revisited

There have been a couple of requests here and on the pyglet mailing list for my code to perform pixel-perfect sprite collisions. I finally had a bit of down time, post-exams, and put together a demo, complete with source code.

The source is pretty clear, and thoroughly commented, so it should be very easy to follow. The demo is very simple, but the concept translates to more complex applications as well. 

You can grab the source directly from my googlecode subversion repository, or if you preferrer, there is a tarball.

Let me know if you have any issues, or questions about the source, and note that it does require a fairly recent version of python (2.5+, for generator expressions and the built-in set class).

Advertisements

4 comments

  1. I may be interested in using this in a potentially commercial game, unfortunately it does not appear to be licensed as anything.

    Can you please place the code under a license or let me know what you consider the usage to be?

    Thanks.

  2. Pingback: Colliding With the Terrain Part 1 « def game():


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s