PYTHON
Write a maze runner game in Python
One way in, and only one way out… video game aficionado Calvin Robinson reveals how to create a vintage maze runner-style game.
OUR EXPERT
Calvin Robinson is a former assistant principal and computer science teacher and has a degree in Computer Games Design and Programming.
QUICK TIP
Introduce additional levels by creating additional room classes.
Room4(Room) would make a new, fourth room, which inherits the properties of Room. Then it’s just a case of defining the ‘walls’ array.
T
his series of tutorials has seen us generate some fantastic replicas of retro video games, using Python. In past issues, we’ve create a lunar landing module game, a side-scrolling platformer,
Pac-Man,
Pong,
the
Game
of
Life,
a bunny shooter, a racing game, and even an
Angry
Birds
clone.
Python is one of the most versatile programming languages around. It’s incredibly high level, making it very accessible, yet it can perform complex tasks. That’s why we’re able to recreate video games that would’ve taken a tremendous amount of processing power when they were first released, in just a few lines of code and using very few resources.
This issue we’re going to create a maze runner. Maze runners were popular in the 1970s and 1980s, and tend to feature a player character, which usually consists of an oblong shape, traversing through a two-dimensional room of blockades and obstacles. Once the player reaches the other side of the maze, they’re transported to another room for a fresh challenge. This top-down maze approach was thought up in 1959, with Mouse in the Maze running on the original MIT TX-0 mainframe.