updated highlighter slgithly
This commit is contained in:
parent
7509196100
commit
c0dc7d7b59
|
|
@ -310,7 +310,8 @@ public class Board {
|
||||||
|
|
||||||
private void highlightedPossibleMoves(Piece piece) {
|
private void highlightedPossibleMoves(Piece piece) {
|
||||||
highlightedSquares.clear();
|
highlightedSquares.clear();
|
||||||
highlightedSquares.addAll(MoveHighlighter.getPossibleMoves(piece, this));
|
MoveHighlighter highlighter= new MoveHighlighter();
|
||||||
|
highlightedSquares.addAll(highlighter.getPossibleMoves(piece, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHighlighted(int x, int y) {
|
public boolean isHighlighted(int x, int y) {
|
||||||
|
|
@ -400,8 +401,4 @@ return false; }
|
||||||
public Piece[][] getBoardArray() {
|
public Piece[][] getBoardArray() {
|
||||||
return board;
|
return board;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ package backend;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class MoveHighlighter {
|
public class MoveHighlighter {
|
||||||
public static ArrayList<int[]> getPossibleMoves(Piece piece, Board board){
|
public ArrayList<int[]> getPossibleMoves(Piece piece, Board board){
|
||||||
ArrayList<int[]> validMoves = new ArrayList<int[]>();
|
ArrayList<int[]> validMoves = new ArrayList<int[]>();
|
||||||
MovePiece movement = new MovePiece(piece, board);
|
MovePiece movement = new MovePiece(piece, board);
|
||||||
PieceType type= piece.getType();
|
PieceType type= piece.getType();
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ public class MovePiece {
|
||||||
this.board = board;
|
this.board = board;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* i honestly dont know if i change it to that or not #keshini
|
/*alternative
|
||||||
* public boolean validateMove(int x, int y, boolean simulate) {
|
* public boolean validateMove(int x, int y, boolean simulate) {
|
||||||
PieceType type = piece.getType();
|
PieceType type = piece.getType();
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue