Skip to content

Commit

Permalink
allow for treetent clue to go up/down
Browse files Browse the repository at this point in the history
  • Loading branch information
longj6 committed Nov 21, 2023
1 parent bb38732 commit 2c77dcf
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions src/main/java/edu/rpi/legup/model/gameboard/GridBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,33 @@ public void setCell(int x, int y, Element e, MouseEvent m) {
if (this instanceof TreeTentBoard && ((y == dimension.height && 0 <= x && x < dimension.width) || (x == dimension.width && 0 <= y && y < dimension.height))) {
TreeTentBoard treeTentBoard = ((TreeTentBoard) this);
TreeTentClue clue = treeTentBoard.getClue(x, y);
if (y == dimension.height && clue.getData() < dimension.width) {
clue.setData(clue.getData() + 1);
}
else {
if (x == dimension.width && clue.getData() < dimension.height) {
clue.setData(clue.getData() + 1);
if (y == dimension.height) {
if (m.getButton() == MouseEvent.BUTTON1) {
if (clue.getData() < dimension.height) {
clue.setData(clue.getData() + 1);
} else {
clue.setData(0);
}
} else {
if (clue.getData() > 0) {
clue.setData(clue.getData() - 1);
} else {
clue.setData(dimension.height);
}
}
else {
clue.setData(0);
} else { //x == dimension.width
if (m.getButton() == MouseEvent.BUTTON1) {
if (clue.getData() < dimension.width) {
clue.setData(clue.getData() + 1);
} else {
clue.setData(0);
}
} else {
if (clue.getData() > 0) {
clue.setData(clue.getData() - 1);
} else {
clue.setData(dimension.width);
}
}
}
}
Expand Down

0 comments on commit 2c77dcf

Please sign in to comment.