Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PacMan Icon
PacMan — Java Edition

A classic PacMan arcade game built from scratch in Java using Swing.


🎮 Gameplay

  • Navigate PacMan through the maze eating all the dots
  • Avoid the 4 ghosts — Blue, Red, Pink, and Orange
  • Eat all pellets to advance to the next level
  • You start with 3 lives — lose them all and it's game over
  • Press any arrow key after Game Over to restart

🕹️ Controls

Key Action
⬆️ Arrow Up Move Up
⬇️ Arrow Down Move Down
⬅️ Arrow Left Move Left
➡️ Arrow Right Move Right
Any arrow key (on Game Over) Restart game

⬇️ Download & Play

Requires Java 21 or laterDownload Java

  1. Go to the Releases page
  2. Download PacMan.jar
  3. Run it:
    java -jar PacMan.jar
    Or simply double-click PacMan.jar if Java is set as the default handler.

🛠️ Build from Source

Prerequisites

  • Java 21+ JDK
  • make (comes pre-installed on macOS/Linux; on Windows use WSL or Git Bash)

Steps

# Clone the repo
git clone https://github.com/dev-kvt/pacman.git
cd pacman

# Compile and package
make jar

# Run
java -jar PacMan.jar

Or run directly without packaging:

make build
java -cp bin App

📁 Project Structure

PacMan/
├── src/
│   ├── App.java          # Entry point — sets up JFrame
│   ├── PacMan.java       # Game logic, rendering, input
│   └── assets/           # PNG sprites & icon
├── bin/                  # Compiled .class files (git-ignored)
├── Makefile              # Build & package commands
├── MANIFEST.MF           # JAR entry point declaration
└── .gitignore

🤖 Technical Highlights

  • HashSet used for walls, foods and ghosts for O(1) lookup
  • javax.swing.Timer drives the 20 FPS game loop
  • AABB collision detection for walls, ghosts and food
  • Ghost AI: random direction changes on wall collisions; forced upward escape from spawn room

📜 License

MIT — free to use, fork, and build upon.


Made with ☕ and Java by Divyansh

About

PacMan — Java Edition A classic PacMan arcade game built from scratch in Java using Swing.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages