Skip to content

Commit

Permalink
Fix issue where already played buttons are playable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nati404 committed May 27, 2024
1 parent c87afb6 commit bf3397a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function resetGame(){
for(let i = 1; i <= 9; i++){
possibleMoves.push(i);
const button = document.getElementById(`button${i}`);
button.style.pointerEvents = "auto";
button.setAttribute("class", "empty");
button.style.backgroundImage = "";
currentMove = 0;
Expand Down Expand Up @@ -70,6 +71,7 @@ function gameHasEnded(){

function makeMove(button){
// Displays whose turn it is
button.style.pointerEvents = "none";
const imageFile = (currentMove == 0) ? xSymbolFile:zeroSymbolFile;
// Apply the correct image to the button
button.style.backgroundImage = `url(${imageFile})`;
Expand Down

0 comments on commit bf3397a

Please sign in to comment.