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

Get Raspberry Pi For Dummies 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.