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.