12Finishing Your First Game: Bounce!

Image

In the previous chapter, we got started building our first game, Bounce!, by creating a canvas and adding a bouncing ball to our code. Right now, our ball will bounce around the screen forever, which doesn’t make for much of a game. In this chapter, we’ll add a paddle for the player to use. We’ll also add an element of chance to the game, which will make it more challenging and fun to play.

Adding the Paddle

There’s not much fun to be had with a bouncing ball when there’s nothing to hit it with. So let’s create a paddle!

We begin by adding the following code directly after the Ball class to create a paddle ...

Get Python for Kids, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.