OOP_2B3_Project/src/backend/Piece.java

61 lines
1.1 KiB
Java

package backend;
public class Piece {
private int x;
private int y;
private PieceType type;
private boolean isWhite;
private boolean hasMoved = false;
private boolean justMovedTwoSquares = false;
public Piece(PieceType type, boolean isWhite, int x, int y) {
this.type = type;
this.isWhite = isWhite;
this.x = x;
this.y = y;
}
public Piece(Piece other) {
this.type = other.type;
this.isWhite = other.isWhite;
this.x = other.x;
this.y = other.y;
this.hasMoved = other.hasMoved;
this.justMovedTwoSquares = other.justMovedTwoSquares;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public PieceType getType() {
return type;
}
public boolean isWhite() {
return isWhite;
}
public boolean hasMoved() {
return hasMoved;
}
public void setHasMoved(boolean moved) {
this.hasMoved = moved;
}
public boolean justMovedTwoSquares() {
return justMovedTwoSquares;
}
public void setJustMovedTwoSquares(boolean movedTwoSquares) {
this.justMovedTwoSquares = movedTwoSquares;
}
}