Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Pause/Resume shortcut key (P) #23

Merged
merged 4 commits into from
Jan 11, 2025

Conversation

colinkiama
Copy link
Owner

This pull request introduces a pause functionality to the game by adding a new event listener for the 'P' key and updating the relevant scenes to handle game pausing and resuming. The most important changes include adding the onPauseRequested method, updating the PauseMenu scene, and modifying the HUD scene.

Pause Functionality:

  • src/scenes/Battle.js: Added onPauseRequested method to handle the 'P' key press, launching the PauseMenu scene and pausing the HUD. Also added event listeners and handlers for pausing and resuming the game. [1] [2] [3]

  • src/scenes/HUD.js: Updated the onPause method to launch the PauseMenu scene using SceneKey.PAUSE_MENU instead of emitting a cross-scene event.

  • src/scenes/PauseMenu.js: Simplified imports and added functionality to emit a pause event, set a background color, and listen for the 'P' key press to resume the game. [1] [2] [3]

@colinkiama colinkiama linked an issue Jan 11, 2025 that may be closed by this pull request
@colinkiama colinkiama merged commit 91a4cd5 into main Jan 11, 2025
@colinkiama colinkiama deleted the 22-implement-pauseresume-shortcut-key-p branch January 11, 2025 22:08
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.

Implement Pause/Resume shortcut key (P)
1 participant