Skip to content

feat: add pause menu with P key toggle and resume functionality - #37

Open
Shubhankar-P wants to merge 1 commit into
dishu4u:mainfrom
Shubhankar-P:feat/pause-menu
Open

feat: add pause menu with P key toggle and resume functionality#37
Shubhankar-P wants to merge 1 commit into
dishu4u:mainfrom
Shubhankar-P:feat/pause-menu

Conversation

@Shubhankar-P

Copy link
Copy Markdown

Summary

Adds a pause menu that allows players to pause and resume the game mid-play.

Changes

  • Added paused boolean field to track pause state
  • Draw semi-transparent pause overlay in draw() with PAUSED title, resume hint, and restart hint — consistent with existing showInstructions overlay style
  • Skip move() in actionPerformed() when paused so ghosts and pacman freeze in place
  • Handle P key in keyReleased() to toggle pause
  • Handle R key in pause menu to restart the game
  • Guard arrow keys when paused to prevent queued direction changes

How to Test

  1. Start the game and begin playing
  2. Press P — game should freeze, pause overlay appears
  3. Press P again — game resumes from exact position
  4. Press P, then R — game restarts fresh

Related Issue

Closes #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Pause Menu Feature

1 participant