From 5dbf1b05531c46bdf025dd482bd7a32c35a080d1 Mon Sep 17 00:00:00 2001 From: Harshil Gupta Date: Wed, 7 Aug 2024 18:21:34 +0530 Subject: [PATCH] Issue resolved --- js/game.js | 17 ++- pages/game.html | 97 ++++++++--------- styles/game.style.css | 240 ++++++++++++++++++++++-------------------- 3 files changed, 189 insertions(+), 165 deletions(-) diff --git a/js/game.js b/js/game.js index 3275520..871e8c1 100644 --- a/js/game.js +++ b/js/game.js @@ -159,9 +159,6 @@ class Game { // Add players to UI addPlayersUI() { - const scoreboardContainer = document.querySelector(".scoreboard-container"); - scoreboardContainer.style.visibility = "visible"; - const scoreboard = document.querySelector(".scoreboard"); scoreboard.innerHTML = ""; // Clear existing content @@ -292,6 +289,10 @@ class Game { if (confirm("Are you sure you want to surrender?")) { this.players.splice(this.currentPlayerIndex, 1); + document + .querySelector(`.player${this.currentPlayerIndex + 1}-score`) + .classList.add("defeated"); + if (this.currentPlayerIndex >= this.players.length) { this.currentPlayerIndex = 0; } @@ -510,7 +511,6 @@ const scoreboard = document.querySelector(".scoreboard-container"); function tourGuide() { const tourSteps = document.querySelectorAll(".tour-step"); let currentStep = 0; - scoreboard.style.display = "block"; const showStep = (index) => { tourSteps.forEach((step, i) => { @@ -564,7 +564,11 @@ function tourGuide() { // Settings Button document.getElementById("setting-btn").addEventListener("click", () => { - menu.classList.toggle("menu-open"); + menu.style.display = "block"; +}); + +document.getElementById("close-menu").addEventListener("click", () => { + menu.style.display = "none"; }); // Surrender Button @@ -578,6 +582,9 @@ const help = document.getElementById("help"); help.addEventListener("click", () => { tourGuide(); stateChange("pause"); + if (window.innerWidth < 768) { + menu.style.display = "none"; + } }); // Restart Game diff --git a/pages/game.html b/pages/game.html index f2fdffe..174ceb3 100644 --- a/pages/game.html +++ b/pages/game.html @@ -78,59 +78,62 @@

Select Avatar

- -
-
- PlayerX's turn -
-
- - -
-
-
-
-
- - -