Akki-jaiswal / Akki-jaiswal/pong-game
Add UI support for Restart and Quit functionality
- Dominant language
- JavaScript
- Stars
- 22
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
The current pong game doesn't include any on-screen options to restart or quit. Users have to manually refresh the browser or close the tab to restart the game, which isn't ideal.
Proposed Enhancements:
Restart Button
Add a button labeled Restart that resets the game state (score, ball position, paddle positions) and starts a new game without reloading the page.
Quit Button
Add a Quit or Exit button that stops the game loop and optionally shows a “Game Over” or “Thanks for playing!” screen.
Implementation Ideas:
Use HTML elements styled with CSS, or draw custom buttons directly on the canvas.
Attach onclick event listeners to trigger a game reset or stop the animation loop.
For “Quit”, consider pausing the game and showing a message overlay instead of just closing the window (since browsers don't allow scripts to close tabs easily).
Contributor guide
Assessment
This issue has not been assessed yet.