A 2D Pac-Man game built with Unity Engine and C# -- featuring player-controlled movement, AI ghost pathfinding, and classic arcade gameplay mechanics.
Project Assignment 3 -- Computer Game Development and Animation, NIT Warangal (Winter 2021)
Note: This is a sample/reference project -- it contains the game's C# scripts only and is not actively deployed.
A faithful recreation of the classic Pac-Man arcade game built in Unity Engine. The player navigates Pac-Man through an enclosed maze, eating dots while avoiding four colored ghosts. The game implements smooth movement with raycasting-based collision detection, ghost AI with predefined patrol patterns, and score tracking.
- Objective: Eat all dots placed in the maze
- Controls: Arrow keys for directional movement
- Win Condition: Collect every dot in the maze
- Lose Condition: Contact with any ghost
| Ghost | Color | Behavior |
|---|---|---|
| Blinky | Red | Aggressive chaser |
| Pinky | Pink | Ambush positioning |
| Inky | Cyan | Unpredictable movement |
| Clyde | Orange | Random patrol pattern |
| Component | Technology |
|---|---|
| Game Engine | Unity Engine |
| Language | C# (MonoBehaviour) |
| Editor | Visual Studio Code |
| Physics | Unity 2D Raycasting |
PacMan-Game__UnityEngine/
├── Scripts/
│ ├── PacmanMove.cs # Player movement, input handling, collision
│ ├── GhostMove.cs # Ghost AI patrol patterns and speed
│ └── Pacdot.cs # Dot positions, collection, and score
├── images/
│ └── Gameplay.png # Gameplay screenshot
└── README.md
- Smooth grid-based movement using
Vector2.MoveTowards() - Keyboard input handling (arrow keys)
- Raycasting for wall collision detection
- Animation parameter updates for directional sprites
- Movement validation before each step
- Predefined waypoint-based movement paths for each ghost
- Individual movement speeds per ghost
- Continuous patrol behavior with path cycling
- Dot position management on the grid
- Collision-triggered destruction on Pac-Man contact
- Score increment on collection
This repository contains the game's C# scripts and a gameplay screenshot only -- the full Unity project (scenes, assets, ProjectSettings/) is not included, so the game cannot be built or played from this repo.
MIT
