Pygame Zero programs

The example programs are now all in one book.

Colour version

Cheaper black and white version

You can also read the text online but it doesn’t look as nice.

Erata (2nd edition)

Section 9.3 (Page 99)

There is one line missing. The code should read:

tile = tiles[maze[row][column]]
if tile == 'empty':
    player.x = column * TILE_SIZE
    player.y = row * TILE_SIZE
elif tile == 'goal':
    print("Well done") exit()

Section 9.5 (Page 101)

Rather than top of program the code should be added just above the draw() function.

Program 10.1

If you have a small screen change 780 to 580 so player fits on the screen.

Program 10.5

This works but in order to see the graphic you drew “alien” should be changed to “enemy”.

Program 10.9

“alien” should be “bullet”.

Program 10.10

“player” should be “bomb”.

Program 11.1

If you have a small screen change 780 to 580 and change 800 to 600 so player fits on the screen.

Section A.5 (Page 130)

There is a word missing. The pyinstaller command should be:

pyinstaller NAME_OF_GAME.py --distpath . --add-data "pgzero;pgzero" --add-data "images;images" --add-data "fonts;fonts" --add-data "sounds;sounds" --add-data "music;music" --onefile --noconfirm --windowed --clean