From 2204ede94b822284e2ee8d7f8a4026ba0aca836a Mon Sep 17 00:00:00 2001 From: Amit <42430868+Amit30swgoh@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:32:11 +0300 Subject: [PATCH] Update settings.js --- 26.9-backgammon/settings.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/26.9-backgammon/settings.js b/26.9-backgammon/settings.js index 3649f69..97d0ad7 100644 --- a/26.9-backgammon/settings.js +++ b/26.9-backgammon/settings.js @@ -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); } };