This post is a portion of Part 12 in my on going series about 2D Game Development using the Allegro 5 library. These posts are in course order. You can see all of the posts in this course by clicking the “2D Game Development” button at the top of this site.

We are finally on to the good stuff. The final algorithm we are going to look at is the pixel perfect collision detection. With this method, we create “masks” for our images, and then based on the distances between images, we form a comparison area. Once formed, we search each mask for bits in the comparison area that match. If they match, we have collision. Simple right?

Full source can be found here.