sei-ec-remote / project-1-issues

Open new issues here
1 stars 2 forks source link

movement #222

Closed ItsAlbi007 closed 9 months ago

ItsAlbi007 commented 9 months ago

What's the problem you're trying to solve?

i have made the checkers to move but the problem is only the first row moves on both sides and sometimes they get mixed up disappear for some unknown reason

Post any code you think might be relevant (one fenced block per file)

function moveChecker(targetSquare, checker) {
  targetSquare.appendChild(checker)
  resetLastColor(checker.classList.contains("red") ? "red" : "blue")
  console.log(moveChecker)
}

//Event listener intialization is to set up event listner on each square and then calls funciton to inilize the event listeners.
function initiate() {
  board.forEach((box) => {
      box.addEventListener('click', (event)=>{
          firstClick(event);

      });
  })

  redChecker.forEach((checker) => {
    checker.addEventListener('click', (event) => {
      firstClick(event)
    })
  })

  blueChecker.forEach((checker) => {
    checker.addEventListener('click', (event) => {
      firstClick(event)
    })
  })
}
initiate()

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

What is your best guess as to the source of the problem?

best guess is i dont have one yet tbh my brain is shutting down

What things have you already tried to solve the problem?

Paste a link to your repository here

https://github.com/ItsAlbi007/G-Project