console class created
This commit is contained in:
parent
b3405ceecb
commit
c0cc47cf56
|
|
@ -157,7 +157,7 @@ public class Board {
|
||||||
|
|
||||||
// user clicks on the board
|
// user clicks on the board
|
||||||
public void userTouch(int x, int y) {
|
public void userTouch(int x, int y) {
|
||||||
if (selectedX == -1 && selectedY == -1) { // ******REVIEW****** Faudrait pas mettre || ?
|
if (selectedX == -1 && selectedY == -1) { // This condition is only possible at the very start of the game
|
||||||
// check if the position is empty and the color
|
// check if the position is empty and the color
|
||||||
if (board[x][y] != null && board[x][y].isWhite() == isTurnWhite()) {
|
if (board[x][y] != null && board[x][y].isWhite() == isTurnWhite()) {
|
||||||
// select it as active location
|
// select it as active location
|
||||||
|
|
@ -167,7 +167,7 @@ public class Board {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (x == selectedX && y == selectedY) {
|
if (x == selectedX && y == selectedY) {
|
||||||
// unselect it
|
// unselect it if the destination is unvalid (not highlighted)
|
||||||
selectedX = -1;
|
selectedX = -1;
|
||||||
selectedY = -1;
|
selectedY = -1;
|
||||||
highlightedPositions.clear();
|
highlightedPositions.clear();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue