Skip to Main Content
Python for Kids, 2nd Edition
book

Python for Kids, 2nd Edition

by Jason R. Briggs
November 2022
Beginner content levelBeginner
368 pages
6h 47m
English
No Starch Press
Content preview from Python for Kids, 2nd Edition

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 ...

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.
Start your free trial

You might also like

Python Cookbook, 3rd Edition

Python Cookbook, 3rd Edition

David Beazley, Brian K. Jones
High Performance Python, 2nd Edition

High Performance Python, 2nd Edition

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9781098141400