This is a beginner-friendly Pac-Man clone built using Python's Turtle Graphics module.
The code is part of a full YouTube tutorial series, where we build the game step by step — covering everything from drawing the maze to player movement, collision logic, and more.
YouTube Playlist: Pac-Man in Python - Full Tutorial Series
Use the links below to access the code for each episode:
- Episode 1 – Project & Screen Setup
- Episodes 2 & 3 – Grid & Maze Drawing
- Episode 4 – Player Setup
- Episode 5 – Wall Collision
- Episode 6 – UI & Pellet Collection
- Episode 7 – Enemies Setup
- Episode 8 – Enemy AI & Final Polish
- Episode 9 – Final Game: Shapes & Sounds
Follow along to:
- Learn basic game development concepts.
- Use Python's Turtle module for graphics.
- Practice clean, modular code structure.
- Build a playable Pac-Man game from scratch.
pacman-turtle-python/
│
├── README.md
├── LICENSE
├── .gitignore
├── screenshots/
│ └── final_game.png
│
└── episodes/
├── episode01/ # Project & Screen setup
| ├── README.md
│ └── main.py
│
├── episode02_03/ # Grid & Maze Drawing
| ├── README.md
│ ├── constants.py
│ ├── main.py
│ ├── mazes.py
│ └── renderer.py
│
├── episode04/ # Player setup
| ├── README.md
│ ├── actors.py
│ ├── constants.py
│ ├── main.py
│ ├── mazes.py
│ └── renderer.py
│
├── episode05/ # Wall Collision
| ├── README.md
│ ├── actors.py
│ ├── constants.py
│ ├── main.py
│ ├── mazes.py
│ └── renderer.py
│
├── episode06/ # UI & Pellet Collection
| ├── README.md
│ ├── actors.py
│ ├── constants.py
│ ├── main.py
│ ├── mazes.py
│ └── renderer.py
│
├── episode07/ # Enemies Setup
| ├── README.md
│ ├── actors.py
│ ├── constants.py
│ ├── main.py
│ ├── mazes.py
│ └── renderer.py
│
├── episode08/ # Enemy AI & Final Polish
| ├── README.md
│ ├── actors.py
│ ├── constants.py
│ ├── main.py
│ ├── mazes.py
│ └── renderer.py
│
└── episode09/ # Final Game: Shapes & Sounds
├── README.md
├── actors.py
├── constants.py
├── death.wav
├── down.gif
├── eat.wav
├── green_enemy.gif
├── left.gif
├── main.py
├── mazes.py
├── pac.gif
├── pink_enemy.gif
├── red_enemy.gif
├── renderer.py
├── right.gif
├── start_up.wav
├── up.gif
└── wall.gif
📦 Note:
episode08/
contains the final version of the game logic, before graphics and sound were added.episode09/
contains the final version of the game, including all custom graphics and sound effects.- 🔊 Sound command depends on your OS — see the
README.md
inepisode09/
for more details. - Movement speed may feel different across operating systems and computers. You can tweak the parameters inside
constants.py
to adjust the speed for a smoother experience.
No external libraries needed – just Python 3.x.
Make sure turtle
is available (it's included with standard Python installs).
python main.py
The game window will open, and you can start playing Pac-Man using the arrow keys!
Created by TheWannabeCoder
Making simple, hands-on Python tutorials for beginners.
YouTube: @TheWannabeCoder
This project is licensed under the MIT License.