O'Reilly logo

Python Game Programming By Example by Joseph Howse, Alejandro Rodas de Paz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic collision detection game

With all of these ingredients, you are now able to write a simple game that detects simple collisions between shapes.

The scene consists of an infinite lane. Blocks appear randomly at the end of the lane and move towards the player, represented as the sphere in the following screenshot. He or she must avoid hitting the blocks by moving the sphere from right to left in the horizontal axis.

The game is over when the player's character collides with one of the blocks.

Basic collision detection game

This gameplay is direct and uncomplicated, and it will allow us to develop a 3D game without worrying too much about more complicated physics calculations. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required