This is code in Python that displays collision detection (thanks to Al Sweigart)