Home > Books > Mission Python

Mission Python: Code a Space Adventure Game

Book cover: Mission Python

Air is running out. There's a leak in the space station, so you've got to act fast. Can you find your way to safety? You'll need to navigate your way through the space station, find the key cards to unlock the doors, and fix your space suit before entering the airlock. The adventure has begun...

And it starts here: on Earth, at mission command, also known as 'your computer'. In this book, you'll learn how to build your own graphical adventure game, with a map to explore, objects to interact with, and tricky logic puzzles.

You'll discover how to use Python to build the Escape game. You'll learn how to customize it, so you can add your own graphics and puzzles, and even use the game engine to build an entirely different game. For the graphical elements, you'll use Pygame Zero.

The game runs on a Windows PC or a Raspberry Pi, and uses free software. The game is supported by a pack of downloadable sounds and graphics to use in building the game.

Mission Python is out now!

Buy the book


See the Escape game from Mission Python in action


Download the Mission Python PDF sampler

Screenshot of the spacewalk simulatorTake a look at Mission Python with this free PDF sampler. It includes the Introduction which shows you how to install the required software and provides instructions for playing the space adventure game, called Escape. It also includes Chapter 1, so you can get your first taste of programming using Python and Pygame Zero, creating a simple spacewalk simulator.

See my blog post: Three reasons to download the free PDF sampler of Mission Python


Download the code from Mission Python and play the game

screenshot of Mission PythonYou can download all the code, graphics and sound effects for Mission Python here.

If you'd like to play the game, simply read the Mission Python sample PDF for instructions on setting it up and playing it.


Additional resources and bonus content

Find out more about Mission Python, including ideas for how you can extend and customise the Escape game code.


Frequently asked questions

How can I install Pygame Zero?

One of the rooms in the Mission Python game EscapeOn Windows and macOS, I now recommend you use the Mu Python editor. It comes with Pygame Zero installed already. When you run Mu, click Mode to check it's on Pygame Zero mode. Enter your program in the big window, and then click the Play button to run it.

On a Raspberry Pi, use Thonny, which is installed as one of the recommended applications in Raspberry Pi OS. It also gives you access to Pygame Zero without any further installation required.

If you want to install Pygame Zero to use with another editor, see the Pygame Zero documentation here.

Note that if you use a different editor to IDLE, the code colouring will be different.

Why does the Mission Python book recommend an old version of Python?

At the time the book was written, Python 3.6 was the latest version on which Pygame Zero worked. Now, I recommend you use a more recent version through Mu or Thonny, as explained above.

Does the Mission Python game work on a Mac?

The book doesn't cover the Mac because I don't have one, and we couldn't test it before release. I was able to thoroughly test the entire project on Windows and Raspberry Pi. However, readers have since told me it works fine on a Mac. The project should work anywhere Pygame Zero runs. There is more information on compatibility here.

How can I be sure the Mission Python game will work on my computer?

You can download the sample chapter and the full game code to test it on your computer before buying the book.

Why isn't the code in Mission Python working for me?

The book has been thoroughly tested. I tested every listing on both Windows and Raspberry Pi, building it from the book. The technical editor also tested all the listings. If a program isn't working for you, there is most likely a problem with your version of the code.

I suggest the following steps:

  • See whether my version of the listing (in the downloads) works for you. You need to copy it out of the listings folder and into its parent folder, so that it sits alongside the images folder where the escape.py program usually is. If my version works, then there's a difference between my version of the code and yours. Pay particular attention to indentation. You might find it useful to refer to the full game listing at the back of the book to double-check the level of indentation. Tip: You can use the Compare feature in Microsoft Word to compare your code with mine and have Word mark up the differences.
  • If my version doesn't work either for you, check that Pygame Zero is correctly installed. I recommend you use Mu or Thonny (see the first answer above) as the simplest way to do this.
  • If you're struggling, feel free to email me.

Where can I find errata and updates?

The book went through extensive quality control, but I've been alerted to a couple of errors that have slipped in despite our best efforts, and the software on the Raspberry Pi has been updated since publication. (The code errors didn't stop the game working). I'm maintaining a blog post for errata and updates here. We are incorporating these updates and corrections into the ebook and reprints of the paper book. If you bought your copy of the book recently, it may have been updated with these changes already.

Credits

© Sean McManus. All rights reserved.

Visit www.sean.co.uk for free chapters from Sean's coding books (including Mission Python, Scratch Programming in Easy Steps and Coder Academy) and more!

Discover my latest books

Coding Compendium

Coding Compendium

A free 100-page ebook collecting my projects and tutorials for Raspberry Pi, micro:bit, Scratch and Python. Simply join my newsletter to download it.

Web Design in Easy Steps

Web Design IES

Web Design in Easy Steps, now in its 7th Edition, shows you how to make effective websites that work on any device.

100 Top Tips: Microsoft Excel

100 Top Tips: Microsoft Excel

Power up your Microsoft Excel skills with this powerful pocket-sized book of tips that will save you time and help you learn more from your spreadsheets.

Scratch Programming in Easy Steps

Scratch Programming IES

This book, now fully updated for Scratch 3, will take you from the basics of the Scratch language into the depths of its more advanced features. A great way to start programming.

Mission Python book

Mission Python

Code a space adventure game in this Python programming book published by No Starch Press.

Cool Scratch Projects in Easy Steps book

Cool Scratch Projects in Easy Steps

Discover how to make 3D games, create mazes, build a drum machine, make a game with cartoon animals and more!

Walking astronaut from Mission Python book Top | Search | Help | Privacy | Access Keys | Contact me
Home | Newsletter | Blog | Copywriting Services | Books | Free book chapters | Articles | Music | Photos | Games | Shop | About