Skip to content

Commit

Permalink
Clue Tile in Editor
Browse files Browse the repository at this point in the history
Editor now requires selecting the clue tile to edit clues
Added images for the tiles
  • Loading branch information
jadeandtea committed Feb 3, 2024
1 parent 6ad1500 commit d76bab4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,12 @@ public void printBoard() {
*/
@Override
public void setCell(int x, int y, Element e, MouseEvent m) {
//TODO Make it so that the clue only changes when the currect editing element is selected
SkyscrapersClue clue = this.getClue(x, y);
if (e == null) return;
if (clue != null) {
if (!e.getElementID().equals("SKYS-UNPL-0003"))
return;

if (m.getButton() == MouseEvent.BUTTON1) {
if (clue.getData() < dimension.height) {
clue.setData(clue.getData() + 1);
Expand All @@ -238,13 +240,7 @@ public void setCell(int x, int y, Element e, MouseEvent m) {
}
}
else {
if (y * dimension.width + x >= puzzleElements.size() || x >= dimension.width ||
y >= dimension.height || x < 0 || y < 0) {
return;
}
else {
puzzleElements.get((y - 1) * dimension.width + (x - 1)).setType(e, m);
}
super.setCell(x - 1, y - 1, e, m);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package edu.rpi.legup.puzzle.skyscrapers.elements;

import edu.rpi.legup.model.elements.NonPlaceableElement;

public class ClueTile extends NonPlaceableElement {

public ClueTile() {
super("SKYS-UNPL-0003", "Clue Tile", "Clue Updater", "edu/rpi/legup/images/skyscrapers/tiles/ClueTile.png");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import edu.rpi.legup.model.elements.NonPlaceableElement;

public class NumberTile extends NonPlaceableElement {

public NumberTile() {
super("SKYS-UNPL-0002", "Number Tile", "A numbered tile", "edu/rpi/legup/images/nurikabe/tiles/NumberTile.png");
super("SKYS-UNPL-0002", "Number Tile", "A numbered tile", "edu/rpi/legup/images/skyscrapers/tiles/ClueTile.png");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super("SKYS-UNPL-0001", "Unknown", "A blank tile", "edu/rpi/legup/images/nurikabe/tiles/UnknownTile.png");
super("SKYS-UNPL-0001", "Unknown", "A blank tile", "edu/rpi/legup/images/skyscrapers/tiles/UnknownTile.png");
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
SKYS-UNPL-0001: Unknown Tile
SKYS-UNPL-0002: Number Tile
SKYS-UNPL-0002: Number Tile
SKYS-UNPL-0003: Clue "Tile"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d76bab4

Please sign in to comment.