O'Reilly logo

Raspberry Pi For Dummies by Mike Cook, Sean McManus

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

Chapter 13

Creating a Game with Python and Pygame

In This Chapter

arrow Getting started with Pygame

arrow Drawing rectangles and circles

arrow Using nested lists to store a game map

arrow Enabling keyboard control of an image

arrow Displaying fancy text messages

arrow Creating game logic, including a bouncing ball

In this chapter, you will build on your Python skills to create a simple arcade game called PiBuster (see Figure 13-1). It’s a variation on the classic format where you have to keep a ball in play using your bat, and your goal is to knock out all the blocks.

Our version has a fruity twist: The wall of bricks is replaced with a giant Raspberry for you to chip away at. The program is written in such a way that you can easily design your own levels. We talk you through how the game works and show you how to build it up step by step.

To help you to create games like this, we introduce you to Pygame, a free library ...

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