The last tutorial ended with the creation of a Sprite class. The
class had the functionality to move itself as well as detect
when it was about to go out of the game screen, and respond to
that by changing its direction of movement. In this part, I'm
going to show you how to implement simple collision detection in
PyGame. The first question that needs to be answered is; what
exactly is collision detection. Well, as you may have already
figured out from the name, it is that part of a game that
detects when two (or more) objects are about to collide with
each other. Technically, that is where the job of the collision
detection part of a game ends. But in most simple games, the
part that detects collisions is also responsible for what comes
next, responding to those collisions. Collision detection is one
of the few pieces that is present in almost all games that have
ever been made. I'm sure you've seen almost realistic physics
effects in games like FEAR, GTA 4, or even Crayon Deluxe. Heck,
even Prince of Persia