Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pac-Man Game

A 2D Pac-Man game built with Unity Engine and C# -- featuring player-controlled movement, AI ghost pathfinding, and classic arcade gameplay mechanics.

Unity C#

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.

Overview

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.

Gameplay

Gameplay

  • 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 Characters

Ghost Color Behavior
Blinky Red Aggressive chaser
Pinky Pink Ambush positioning
Inky Cyan Unpredictable movement
Clyde Orange Random patrol pattern

Tech Stack

Component Technology
Game Engine Unity Engine
Language C# (MonoBehaviour)
Editor Visual Studio Code
Physics Unity 2D Raycasting

Project Structure

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

Script Details

PacmanMove.cs

  • 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

GhostMove.cs

  • Predefined waypoint-based movement paths for each ghost
  • Individual movement speeds per ghost
  • Continuous patrol behavior with path cycling

Pacdot.cs

  • Dot position management on the grid
  • Collision-triggered destruction on Pac-Man contact
  • Score increment on collection

Availability

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.

License

MIT

About

Classic Pac-Man arcade game recreated in Unity Engine with ghost AI and scoring system

Topics

Resources

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages