fixed but doesnt higlight if no piece is in the way
This commit is contained in:
parent
8a67fc5aff
commit
37b2bb2a2f
|
|
@ -183,19 +183,23 @@ public class Board {
|
|||
|
||||
/* The following methods require more work ! */
|
||||
|
||||
public boolean isHighlighted(int x, int y) {
|
||||
public boolean isHighlighted(int x, int y) {
|
||||
Piece myPiece = getPiece(x,y);
|
||||
boolean isAPieceHere = false ; // final return boolean value
|
||||
PieceType type = getPiece(x,y).getType(); // type of piece variable that we will get trough a loop, this will determine the pattern of highlights on the board
|
||||
boolean color = getPiece(x,y).isWhite(); //color of the piece for pawns that can only go in -y for black and +Y for white
|
||||
PieceType type = null;
|
||||
boolean color = false;
|
||||
|
||||
for(int i = 1; i < 2;i++)
|
||||
if(myPiece != null) {
|
||||
type = getPiece(x,y).getType(); // type of piece variable that we will get trough a loop, this will determine the pattern of highlights on the board
|
||||
color = getPiece(x,y).isWhite(); //color of the piece for pawns that can only go in -y for black and +Y for white
|
||||
for(int i = 1; i < 2;i++)
|
||||
|
||||
if(selectX == x && selectY == y+i) {
|
||||
isAPieceHere = true;
|
||||
if(selectX == x && selectY == y+i) {
|
||||
isAPieceHere = true;
|
||||
}
|
||||
return isAPieceHere;
|
||||
}
|
||||
|
||||
return isAPieceHere;
|
||||
}
|
||||
|
||||
public Piece getPiece(int x, int y) {
|
||||
Piece concernedPiece = null; //initialization of piece var
|
||||
|
|
|
|||
Loading…
Reference in New Issue