sei-ec-remote / project-1-issues

Open new issues here
1 stars 2 forks source link

movement #228

Closed ItsAlbi007 closed 9 months ago

ItsAlbi007 commented 9 months ago

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

i need some sort of gameplan for the checker to hop over the opponent checker if thre is an opening and for that opponent to get eliminated from the game

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

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?

i need to somehow id the square that's behind the opponent and jump over it and eliminate it

What things have you already tried to solve the problem?

Paste a link to your repository here

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

nayaba commented 9 months ago

So I see that you're using some math to check for diagonals.

      const diagonalOne = document.querySelector(`#c${col -1}r${row +1}`)
      const diagonalTwo = document.querySelector(`#c${col -1}r${row -1}`)

Is it possible to check for diagonals from diagonalOne and diagonalTwo? After which you can determine if there is an opening and if so, allow the checker piece to occupy that opening?

See if you can implement that first, then you can start to tackle removing the other player's "jumped" piece.