A couple of months ago, No Starch Press asked me if I would be interested in reading one of their new books called Mission Python: Code a Space Adventure Game! by Sean McManus. I enjoy reading new tech books, but it's hard to work them in when I've been so busy this past year. However one of my resolutions for 2019 is to read through my backlog of tech books, so I decided to tackle this one next!
You can get this book as a paperback, PDF, Mobi, or ePub.
This book contains 12 chapters and 3 appendices across 280 pages. The code in this book is for Windows or Raspberry Pi. You will also need Python 3 for this book as it uses PyGame Zero, which requires Python 3.
Mission Python attempts to teach you the Python programming language while also building a 2D video game using PyGame Zero. The introduction helpfully explains how to install Python and the dependencies needed for the game on Windows and Raspberry Pi. If you happen to be on Linux or Mac, you will have to figure out how to install it on your own.
The first chapter of the book instructs the reader on using Python's IDLE application for developing your code. The rest of the chapter introduces you to writing the some of the the game. Basically you create the background for the game and learn about blitting. You also learn how to move a character in the game using your keyboard.
Chapter 2 digs into Python lists and how you can use them in conjunction with your game. The author uses list building and accessing elements within a list to help the reader create space related checklists and eventually a map of sorts. It's a rather creative way to integrate Python lists and a video game at the same time.
The next step in the reader's journey is learning about Python loops in chapter 3. Loops are used for printing the "map" to the screen. The map is basically a matrix of numbers. After describing how to do nested loops, the author uses that newfound knowledge to help the user create a room image using PyGame Zero's drawing abilities.
For chapter 4, the author teaches the reader how to create the map and the automatic map maker too. Here you will learn how to use PyGame Zero to draw the map onscreen and debug the code when you inevitably run into issues.
Chapters 5 and 6 are about the space station's equipment and focus on Python dictionaries. Here the reader will learn how to mix data types in Python, such as adding lists to dictionaries. You will also be learning how to load scenery into the rooms in your game.
The goal of chapter 7 is to teach you how to move your sprites about in the game. For this task, the reader learns how to hook up the keyboard to the game and the different versions of the sprites you will need to make movement look natural.
The rest of the book builds up various parts of the game itself. You will be learning how to use functions along the way and there are exercises spread throughout the book. Most of the rest of the book focuses on PyGame specific functions and methods and how to use them effectively.
This book seems well organized and pretty well written. I personally find the chapter titles a bit confusing as you can't really tell from the titles alone what the chapter is actually about. The section names are sometimes written in an obtuse manner as well. However the content of the book is interesting and it's fun to learn how to write a game in Python. I would give this book to someone who would like to learn all the moving parts of writing a game in Python. You won't be learning game theory, but it's still a good introduction to game development with nice, small chunks of code.
You can visit the author's website to get a free sample of the book and learn more about it as well.
by Sean McManus
Copyright © 2021 Mouse Vs Python | Powered by Pythonlibrary