Chapter 6
Collision Detection
In the last chapter, you added all of the game elements to the game world: bricks, a player paddle, and the ball. After running your code, however, you found that although you could move the player paddle, it had no effect on the gameplay. The ball starts in a random position and ends up falling off the bottom of the screen. The reason for this is the distinct lack of collision detection in your game.
In this chapter, you will add collision detection to the game.
The Purpose of Collision Detection
The strict definition of collision detection is, well, detecting when elements on the screen have collided. It is much more crucial than that, however. A good collision detection system tests for and evaluates when ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access