Skip to content

Paddle Battle: Implement configurable Winning Score and Sound Toggle for Paddle Battle #17

@Bana0615

Description

@Bana0615

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

  • A new setting is added to the SettingsScene for "Winning Score" with options for 5, 10, and 15 points.
  • A new setting is added to the SettingsScene for "Sound" with a simple on/off toggle.
  • The MainScene game logic uses the selected "Winning Score" from the settings instead of a hardcoded value.
  • All in-game sound effects (e.g., paddle hits, scores) are muted when the "Sound" toggle is set to off.
  • The selected "Winning Score" and "Sound" settings are persisted in local storage via settingsManager.ts.
  • The SettingsScene UI correctly reflects the currently saved settings on load.

Labels

feature, games, frontend, enhancement

Priority

Medium

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions