Akki-jaiswal / Akki-jaiswal/pong-game
[Feature] Implement Live Score Tracking and High Score Persistence Using localStorage
- Lingua principale
- JavaScript
- Stelle
- 22
- Fork
- 116
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The current Pong game UI visually displays the player and AI scores during gameplay (Player: X | AI: Y). However, the scores are not persisted beyond the current session and there's no high score tracking feature implemented.
This issue proposes enhancing the game by:
Tracking player and AI scores live.
Persisting scores using localStorage.
Storing and displaying high scores (per device/browser).
🛠️ Feature Requirements:
✅ Track live game scores for Player and AI.
✅ Save playerScore and aiScore in localStorage after every point.
✅ Load saved scores from localStorage when the game starts.
✅ Track high score:
Maintain the highest score ever reached by the player.
Display the high score on the UI (e.g., beside Player label or below the scoreboard).
✅ Add a “Reset Score” button that:
Resets both scores.
Clears values from localStorage.
Optionally clears the high score.
🎯 UI Integration Suggestions:
Display High Score near the existing "Player: X | AI: Y" label at the top center.
Add a small reset icon/button beside the score to clear/reset local data.
Style the high score label with a unique color or glowing effect (e.g., gold or neon).
✅ Expected Outcome:
Player and AI scores are persisted across page reloads.
High score is tracked and updated automatically.
Players can reset scores manually.
A more engaging and persistent gameplay experience.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.