A simple Pac-Man clone implemented in Java using Swing and AWT libraries.
This project is a basic implementation of the classic Pac-Man arcade game. The player controls Pac-Man through a maze, eating pellets while avoiding ghosts. Power pellets allow Pac-Man to temporarily eat the ghosts for bonus points.
- Tile-based maze with walls, paths, and pellets
- Player-controlled Pac-Man character
- Multiple ghosts with different behaviors
- Power pellets that allow Pac-Man to eat ghosts
- Score tracking
- Game over and win conditions
- Arrow Keys: Move Pac-Man
- Esc: Exit the game
- Open the project in your favorite Java IDE (Eclipse, IntelliJ IDEA, etc.)
- Run the
Main.java
file
- Navigate to the project directory
- Compile the Java files:
javac -d bin src/*.java
- Run the game:
java -cp bin Main
- Move Pac-Man around the maze to eat all the pellets
- Avoid the ghosts - if they catch you, you lose
- Eat power pellets to temporarily make ghosts vulnerable
- Eat vulnerable ghosts for bonus points
- Complete the level by eating all pellets
Main.java
: Entry point of the applicationGameFrame.java
: Sets up the game windowGamePanel.java
: Handles the game loop, rendering, and inputPacMan.java
: Represents the player characterGhost.java
: Represents the enemy charactersMaze.java
: Stores the maze layoutPellet.java
: Represents collectible itemsTile.java
: Represents a single tile in the mazeDirection.java
: Enum for movement directionsPosition.java
: Utility class for positions in the maze
This game was created as a simple Java implementation of the classic Pac-Man game.