mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-17 18:26:01 +00:00
Feat: Add temporary 2x brightness highlight for last move
This commit is contained in:
7
game.js
7
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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user