Add two space pawn movement

main
Elnu 2 years ago
parent 36f3873816
commit dcde9d5ecd

@ -13,8 +13,10 @@ public class Pawn extends Piece {
ArrayList<BoardCoordinate> possibleMoves = new ArrayList<>(); ArrayList<BoardCoordinate> possibleMoves = new ArrayList<>();
if (this.black) { if (this.black) {
possibleMoves.add(new BoardCoordinate(position.x, position.y + 1)); possibleMoves.add(new BoardCoordinate(position.x, position.y + 1));
if (position.y == 1) possibleMoves.add(new BoardCoordinate(position.x, position.y + 2));
} else { } else {
possibleMoves.add(new BoardCoordinate(position.x, position.y - 1)); possibleMoves.add(new BoardCoordinate(position.x, position.y - 1));
if (position.y == 6) possibleMoves.add(new BoardCoordinate(position.x, position.y - 2));
} }
return possibleMoves; return possibleMoves;
} }