From 88937d85a66bff83a80cf1d0724e20b775006606 Mon Sep 17 00:00:00 2001 From: Ronnie Date: Tue, 27 May 2025 21:44:37 -0400 Subject: [PATCH] Enhance game settings UI with improved button styles and icons; update difficulty and mode selection logic to show relevant information dynamically. --- game.js | 19 +++- index.html | 44 ++++---- styles.css | 316 +++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 307 insertions(+), 72 deletions(-) diff --git a/game.js b/game.js index 8fdf7f0..7775e4d 100644 --- a/game.js +++ b/game.js @@ -142,9 +142,12 @@ function showDeathScreen() { levelRow.style.display = 'flex'; } - // Update mode and difficulty badges - document.querySelector('.mode-text').textContent = gameState.selectedMode; - document.querySelector('.difficulty-text').textContent = gameState.selectedDifficulty; + // Update mode and difficulty badges with proper capitalization + const modeText = gameState.selectedMode.charAt(0).toUpperCase() + gameState.selectedMode.slice(1); + const difficultyText = gameState.selectedDifficulty.charAt(0).toUpperCase() + gameState.selectedDifficulty.slice(1); + + document.querySelector('.mode-text').textContent = modeText; + document.querySelector('.difficulty-text').textContent = difficultyText; // Show death screen deathScreen.classList.add('show'); @@ -178,6 +181,11 @@ difficultyButtons.forEach(button => { button.classList.add('active'); gameState.selectedDifficulty = button.dataset.difficulty; setCookie('difficulty', gameState.selectedDifficulty, 365); + + // Update info text visibility + document.querySelectorAll('.difficulty-info .info-text').forEach(info => info.style.display = 'none'); + document.querySelector(`.${gameState.selectedDifficulty}-info`).style.display = 'block'; + restartGame(); }); }); @@ -188,6 +196,11 @@ modeButtons.forEach(button => { button.classList.add('active'); gameState.selectedMode = button.dataset.mode; setCookie('mode', gameState.selectedMode, 365); + + // Update info text visibility + document.querySelectorAll('.mode-info .info-text').forEach(info => info.style.display = 'none'); + document.querySelector(`.${gameState.selectedMode}-info`).style.display = 'block'; + restartGame(); }); }); diff --git a/index.html b/index.html index 8310367..0b4a97f 100644 --- a/index.html +++ b/index.html @@ -58,28 +58,30 @@

Game Settings

-
-

Select Difficulty

-
- - - +
+
+

Select Difficulty

+
+ + + +
+
+

Easy: 10 squares, slower speed, infinite lives

+

Medium: 15 squares, medium speed, 5 lives

+

Hard: 20 squares, fast speed, 3 lives

+
-
-

Easy: 10 squares, slower speed, infinite lives

-

Medium: 15 squares, medium speed, 5 lives

-

Hard: 20 squares, fast speed, 3 lives

-
-
-
-

Game Mode

-
- - -
-
-

Levels: Clear all squares to advance. Lives matter!

-

Endless: Keep clearing squares for high score

+
+

Game Mode

+
+ + +
+
+

Levels: Clear all squares to advance. Lives matter!

+

Endless: Keep clearing squares for high score

+