32 lines
813 B
Java
32 lines
813 B
Java
package project.chess;
|
|
|
|
import java.awt.*;
|
|
import java.util.ArrayList;
|
|
|
|
import static project.ui.Display.loadImage;
|
|
|
|
public class Bishop extends ChessPiece {
|
|
|
|
private Image whiteBishop = loadImage("./resources/chess_piece_2_black_bishop.png");
|
|
private Image blackBishop = loadImage("./resources/chess_piece_2_white_bishop.png");
|
|
|
|
public Bishop(Board b, boolean isWhite, int x, int y) {
|
|
super(b,isWhite,x,y);
|
|
}
|
|
|
|
public Image getImage(){
|
|
if (isWhite)
|
|
return whiteBishop;
|
|
return blackBishop;
|
|
}
|
|
|
|
@Override
|
|
public ArrayList<Move> getMoves() {
|
|
return new ArrayList<Move>(super.getDiagonalMoves(b.size()));
|
|
}
|
|
|
|
public Bishop clone () {
|
|
return new Bishop(this.b,this.isWhite,this.x,this.y);
|
|
}
|
|
}
|