almost same as isSelected, understanding that i need to playwith

coordinates in if statements
This commit is contained in:
hugomanipoud2 2025-05-20 14:38:40 +02:00
parent 2f327e8af7
commit 3164fcde7c
1 changed files with 6 additions and 3 deletions

View File

@ -127,6 +127,7 @@ public class Board {
if(setSelectXY(x,y) == true) { // checks for pieces at the position x and y
selectX = x; //set select x to x
selectY = y; // same with y
isHighlighted(x,y);
}
}else { //if select x and y arent at their initial value (means that a piece is selected in the grid)
@ -177,15 +178,17 @@ public class Board {
public Board(String[] array) {
//TODO
}
/* The following methods require more work ! */
public boolean isHighlighted(int x, int y) {
boolean isAPieceHere = setSelectXY(x,y);
boolean isAPieceHere = false ;
if(selectX == x+1 && selectY == y+1) {
isAPieceHere = true;
}
return isAPieceHere;
}
}
public void undoLastMove() {
//TODO