pawns cannot go further if a piece is in front of them regardless of
color
This commit is contained in:
parent
95ace3afe1
commit
ac2a23e9a9
|
|
@ -71,10 +71,10 @@ public class Move {
|
||||||
if (color == true) {
|
if (color == true) {
|
||||||
int k = isFirstPawnMove(yCord); // determine if k should be 3 or 2 to begin with
|
int k = isFirstPawnMove(yCord); // determine if k should be 3 or 2 to begin with
|
||||||
for(int i = 1; i < k;i++) { // this loop iterates from 1 to 3 as pawns for their first move can go forward 2 slots. removing 0 let the is selected function do its job
|
for(int i = 1; i < k;i++) { // this loop iterates from 1 to 3 as pawns for their first move can go forward 2 slots. removing 0 let the is selected function do its job
|
||||||
if (board.getPiece(selectX , selectY + i) != null) {
|
if (board.getPiece(x,y) != null) {
|
||||||
if(selectX == x && selectY == y+i) { // this loop iterates 2 times trough the for loop, giving multiples coordinates to highlight ( here : (x;y+1)&(x;y+2))
|
return false;
|
||||||
return true; //set the boolean var to true
|
}else if(selectX == x && selectY == y+i) { // this loop iterates 2 times trough the for loop, giving multiples coordinates to highlight ( here : (x;y+1)&(x;y+2))
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { //if color == false so for black pieces
|
} else { //if color == false so for black pieces
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue