Knight.java
package Pieces;
import Game.*;
public class Knight extends BoardSquare {
public Knight(){
this.hasMoved = false;
horiz = false;
vert = false;
diag = false;
bidirectional = false;
limit = 0;
symbol = 'N';
imagename = "Knight.png";
}
public Knight(int x, int y, Player player){
this();
this.x = x;
this.y = y;
this.owner = player;
}
@Override
public boolean MoveThis(Board gameBoard, BoardSquare startSquare, BoardSquare destSquare) {
int xdiff = Math.abs(startSquare.x - destSquare.x);
int ydiff = Math.abs(startSquare.y - destSquare.y);
if ((xdiff == 2 && ydiff == 1) || (xdiff == 1 && ydiff == 2))
return true;
return false;
}
}