A modern C++ implementation of the classic Pac-Man arcade game. Navigate through the maze, collect dots, avoid ghosts, and use power-ups to turn the tables on your pursuers!
- 👾 Classic Pac-Man gameplay mechanics
- 👻 Multiple ghosts with AI behavior
- 🍒 Dots and energizers collection
- 🧱 Wall collision detection and tunnel warping
- 📊 Score tracking and multiple lives
- 🔄 Game over screen with replay option
| Key | Action |
|---|---|
| I | Move Up |
| K | Move Down |
| J | Move Left |
| L | Move Right |
| ESC | Pause/Unpause |
| ENTER | Restart (after Game Over) |
| ESC | Exit (after Game Over) |
├── main.cpp # Application entry point
├── Game.h/cpp # Core game loop and coordination
├── GameObject.h/cpp # Base class for all game objects
├── Pacman.h/cpp # Player character implementation
├── Ghost.h/cpp # Enemy implementation
├── GhostStrategy.h/cpp # Ghost AI behavior strategies
├── Maze.h/cpp # Game map and collision detection
├── Dot.h/cpp # Collectible implementation
└── Energizer.h/cpp # Power-up implementation
- Pacman: Handles user input, power-up states, and character animation
- Ghosts: Implements AI movement and state transitions between normal and frightened modes
- Maze: Manages game map layout, walls, tunnels, and item placement
- Game: Orchestrates object interactions, collisions, and game state
The game can be easily customized:
- Modify the number of ghosts by updating ghost-count values in
Game.h,Maze.hand the map inMaze.cpp - Adjust game difficulty by tweaking ghost speeds and AI behavior
- Change maze layouts for different levels
- Pacman colour can also be altered in
pacman.cpp
- C++ compiler (built on Visual Studio Code 2022 & Cursor)
- SFML 2.5.1 - Click for setup guide
This project is released under the MIT License.



