A classic Pac-Man clone built in Java using javax.swing and java.awt, featuring a custom tile-based map, ghost AI, sound effects, level progression, power pellets, and tunnel wrap-around.
- Classic gameplay — navigate Pac-Man through a maze, eat food dots, avoid ghosts
- Sound effects — plays audio on eating food, dying, and game over
- Level progression — clearing all food advances the level and speeds up the game
- Power pellets — four large pellets in the map corners; eating one lets Pac-Man eat ghosts for bonus points (+200) for a limited time
- Tunnel wrap-around — Pac-Man exits one side of the map and reappears on the opposite side through the ghost-spawn row
- Pause — press
Pto pause/unpause mid-game - Lives and scoring — 3 lives, score tracked and displayed on screen
| Key | Action |
|---|---|
| Arrow Up | Move up |
| Arrow Down | Move down |
| Arrow Left | Move left |
| Arrow Right | Move right |
| P | Pause / unpause |
| Any key | Restart after Game Over |
- Java JDK 8 or higher
- The following image assets in the same folder as
PacMan.java:wall.pngblueGhost.png,orangeGhost.png,pinkGhost.png,redGhost.pngpacmanUp.png,pacmanDown.png,pacmanLeft.png,pacmanRight.png
- The following sound assets (
.wavformat) in the same folder:eat.wavdeath.wavgameOver.wav
- Make sure all image and sound files are in the same directory as
PacMan.java. - Compile the project:
javac PacMan.java - Run it (you'll need a
Mainclass or equivalent entry point that creates aJFrameand adds thePacManpanel to it):java Main
PacMan.java # Main game logic, rendering, and controls
wall.png # Wall tile image
*Ghost.png # Ghost sprite images
pacman*.png # Pac-Man directional sprites
*.wav # Sound effect files
(Sahr Momoh Solokor)
This project is for educational and portfolio purposes.