Skip to content

Commit

Permalink
Update settings.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit30swgoh authored Sep 26, 2024
1 parent f5ea176 commit 2204ede
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions 26.9-backgammon/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ const gameSettings = {
soundEnabled: true,
playerNames: { yellow: "Player 1", white: "Player 2" },

// Toggle sound on or off
toggleSound: function () {
this.soundEnabled = !this.soundEnabled;
alert(`Sound ${this.soundEnabled ? 'enabled' : 'disabled'}`);
this.showAlert(`Sound ${this.soundEnabled ? 'enabled' : 'disabled'}`);
},

// Set player names for yellow and white
setPlayerNames: function (yellowName, whiteName) {
this.playerNames.yellow = yellowName;
this.playerNames.white = whiteName;
alert(`Player names updated: ${yellowName} (Yellow), ${whiteName} (White)`);
this.showAlert(`Player names updated: ${yellowName} (Yellow), ${whiteName} (White)`);
},

// Utility function to show alerts (can be extended)
showAlert: function (message) {
alert(message);
}
};

0 comments on commit 2204ede

Please sign in to comment.