diff --git a/game.js b/game.js index c78a778..232cc3f 100644 --- a/game.js +++ b/game.js @@ -94,7 +94,12 @@ class Connect5Game { // Update UI const cellIndex = row * this.boardSize + col; const cell = this.boardElement.children[cellIndex]; - cell.classList.add("occupied", this.currentPlayer.toLowerCase()); + cell.classList.add("occupied", this.currentPlayer.toLowerCase(), "latest-move"); + + // Remove brightness boost after 2 seconds + setTimeout(() => { + if (cell) cell.classList.remove("latest-move"); + }, 2000); // In local mode only, check for win/draw and switch player if (!multiplayerClient || !multiplayerClient.isMultiplayer) { diff --git a/multiplayer.js b/multiplayer.js index 2b760f9..84f92d7 100644 --- a/multiplayer.js +++ b/multiplayer.js @@ -519,8 +519,13 @@ class MultiplayerClient { const cell = this.game.boardElement.children[cellIndex]; if (cell) { - cell.classList.add('occupied', data.symbol.toLowerCase()); + cell.classList.add('occupied', data.symbol.toLowerCase(), 'latest-move'); this.game.board[data.row][data.col] = data.symbol; + + // Remove brightness boost after 2 seconds + setTimeout(() => { + if (cell) cell.classList.remove('latest-move'); + }, 2000); } // It's now my turn