Feat: Implement configurable Winning Score and Sound Toggle for Paddle Battle
Description
Problem/Goal
The game "Paddle Battle" currently has a fixed winning score of 10 and lacks an option for players to control in-game sound effects. This limits player experience and accessibility. We need to introduce a configurable winning score to allow for shorter or longer matches and a sound toggle to give players control over the audio.
Context/Background
The MainScene.ts file for "Paddle Battle" hardcodes the WINNING_SCORE to 10. To make the game more flexible, we should move this to a user-configurable setting. Additionally, there is no existing setting for muting game sounds. The SettingsScene.ts and settingsManager.ts already provide a pattern for managing and persisting settings (e.g., difficulty), which should be leveraged for these new features.
Proposed Solution/Approach
- Winning Score: Add a new setting to the
SettingsScene to allow players to choose a winning score (e.g., 5, 10, 15). The selected value should be saved using settingsManager.ts and passed to the MainScene during game initialization. The hardcoded WINNING_SCORE constant in MainScene.ts should be replaced with the value from the settings.
- Sound Toggle: Implement a simple toggle switch in the
SettingsScene that controls a new soundEnabled setting. This setting should be persisted using settingsManager.ts. All sound-related functions in the game, such as when the ball hits a paddle, should be conditional on this new setting.
Acceptance Criteria
Labels
feature, games, frontend, enhancement
Priority
Medium
Feat: Implement configurable Winning Score and Sound Toggle for Paddle Battle
Description
Problem/Goal
The game "Paddle Battle" currently has a fixed winning score of 10 and lacks an option for players to control in-game sound effects. This limits player experience and accessibility. We need to introduce a configurable winning score to allow for shorter or longer matches and a sound toggle to give players control over the audio.
Context/Background
The
MainScene.tsfile for "Paddle Battle" hardcodes theWINNING_SCOREto10. To make the game more flexible, we should move this to a user-configurable setting. Additionally, there is no existing setting for muting game sounds. TheSettingsScene.tsandsettingsManager.tsalready provide a pattern for managing and persisting settings (e.g., difficulty), which should be leveraged for these new features.Proposed Solution/Approach
SettingsSceneto allow players to choose a winning score (e.g., 5, 10, 15). The selected value should be saved usingsettingsManager.tsand passed to theMainSceneduring game initialization. The hardcodedWINNING_SCOREconstant inMainScene.tsshould be replaced with the value from the settings.SettingsScenethat controls a newsoundEnabledsetting. This setting should be persisted usingsettingsManager.ts. All sound-related functions in the game, such as when the ball hits a paddle, should be conditional on this new setting.Acceptance Criteria
SettingsScenefor "Winning Score" with options for 5, 10, and 15 points.SettingsScenefor "Sound" with a simple on/off toggle.MainScenegame logic uses the selected "Winning Score" from the settings instead of a hardcoded value.settingsManager.ts.SettingsSceneUI correctly reflects the currently saved settings on load.Labels
feature,games,frontend,enhancementPriority
Medium