Linux Format

Recreate the classic Pac-Man in Python

This issue we’re going to look at a game of Pac-Man created in Python using the PyGame library. The code for this project has been adapted from https://pacmancode.com where the original source code can be downloaded.

We’ll install and setup Python 3.10 for the benefit of this tutorial. For those that have Python/PyGame already installed, Python 3.8+ should be a good-enough version to use with this tutorial. Type the following to install Python 3.10 and PyGame:

This project uses the numpy Python library and can be installed using pip by using the following commands if it’s not already installed.

$ pip install numpy

To ensure you’re calling the correct pip version, check the Scripts folder of the Python installation folder. There may be a version number of pip to use, such as pip3.8. Check the versions of python and pygame, too. Next, git clone from repository:

$ git clone https://github.com/asmith1979/lxf294_ pacman/

The project has been placed in a folder called PythonProjects, which was created before downloading the project. The source code and project can also be retrieved from the archive. This tutorial will focus on the source code located in the folder called If you’re not already in that folder type cd lxf294_pacman to access the Python source code.

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format5 min read
Tips For Managing Docker Containers
Everyone knows how containers revolutionised application building and deployment. Using a E disposable stack of containers that make up an app that aren’t using the docker-compose command to manage the stack are missing a trick. It allows the shippin
Linux Format1 min read
Installation Complications
The Linux Mint system package for Timewarrior was out of date, so we installed the latest version from Snap. The Hamster package in the distribution repository was the latest stable release (which is quite old), but we could also have installed via F
Linux Format3 min read
Drauger OS 7.6
We love the idea of a gaming-specific version of Linux, but Drauger fails to deliver. Given the setup/kernel issues, you’re far better off installing Ubuntu, then adding gamingspecific packages yourself. CPU: 1.8GHz (2GHz suggested) Mem: 1GB (6GB sug

Related Books & Audiobooks