Feat: Add temporary 2x brightness highlight for last move

This commit is contained in:
2025-12-23 22:02:04 +11:00
parent d1bcf36887
commit 74de333006
2 changed files with 12 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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