isSelected finished, working on usertouch

This commit is contained in:
hugomanipoud2 2025-05-18 19:58:42 +02:00
parent a4250943d4
commit c87dfd94b5
1 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,8 @@ public class Board {
private ArrayList<Piece> pieces; // list of all pieces on the board
private Piece newPiece; // to add a piece to the board
private int turnNb = 0;
private int selectX = -1;
private int selectY = -1;
//initiation of the board, creating an 8 * 8 grid
public Board(int colNum, int lineNum) {
@ -117,12 +119,19 @@ public class Board {
}
public void userTouch(int x, int y) {
//TODO
if(selectX == x && selectY == y) {
}
}
public boolean isSelected(int x, int y) {
//TODO
for(Piece piece : pieces) {
if(piece.getX() == x && piece.getY() == y) {
return true;
}
}
return false;
}