user touch change has moved
This commit is contained in:
parent
c6c29dfb94
commit
60ac37cd2f
|
|
@ -7,6 +7,15 @@ public class Piece {
|
|||
private int y;
|
||||
private boolean pieceColor;
|
||||
private PieceType type;
|
||||
private boolean hasMoved = false;
|
||||
|
||||
public boolean getHasMoved() {
|
||||
return hasMoved;
|
||||
}
|
||||
|
||||
public void setMoved(boolean moved) {
|
||||
this.hasMoved = moved;
|
||||
}
|
||||
|
||||
public Piece(int x,int y, PieceType type,boolean pieceColor) {
|
||||
this.x = x;
|
||||
|
|
@ -104,6 +113,10 @@ public class Piece {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!this.getHasMoved()) {
|
||||
int yRow = this.isWhite() ? 7: 0; // if white, row = 7 else row = row = 0 (mapping of boolean 0,1 --> 7,0 rows)
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case Knight:
|
||||
|
|
@ -126,6 +139,7 @@ public class Piece {
|
|||
|
||||
return moves;
|
||||
}
|
||||
|
||||
private void addLinearMoves(Board board, ArrayList<int[]> moves, int x, int y, int dx, int dy) {
|
||||
int nx = x + dx;
|
||||
int ny = y + dy;
|
||||
|
|
|
|||
Loading…
Reference in New Issue