Skip to content

Commit

Permalink
Merge pull request #629 from charlestian23/dev
Browse files Browse the repository at this point in the history
Light Up puzzle editor fix
  • Loading branch information
Chase-Grajeda authored Oct 10, 2023
2 parents a52b65d + f98bc7d commit 97be2be
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
37 changes: 37 additions & 0 deletions src/main/java/edu/rpi/legup/puzzle/lightup/LightUpCell.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package edu.rpi.legup.puzzle.lightup;

import edu.rpi.legup.model.elements.Element;
import edu.rpi.legup.model.gameboard.GridCell;

import java.awt.*;
import java.awt.event.MouseEvent;

public class LightUpCell extends GridCell<Integer> {
private boolean isLite;
Expand All @@ -12,6 +14,41 @@ public LightUpCell(int valueInt, Point location) {
this.isLite = false;
}

@Override
public void setType(Element e, MouseEvent m) {
switch (e.getElementID()) {
case "LTUP-PLAC-0001":
this.data = -4;
break;
case "LTUP-UNPL-0002":
this.data = -1;
break;
case "LTUP-UNPL-0003":
this.data = -2;
break;
case "LTUP-UNPL-0001":
switch (m.getButton()){
case MouseEvent.BUTTON1:
if (this.data < 0 || this.data > 3) {
this.data = 0;
}
else {
this.data = this.data + 1;
}
break;
case MouseEvent.BUTTON3:
if (this.data > 0) {
this.data = this.data - 1;
}
else {
this.data = 4;
}
break;
}
break;
}
}

public LightUpCellType getType() {
switch (data) {
case -4:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package edu.rpi.legup.puzzle.lightup.elements;

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

public class BlackTile extends PlaceableElement {
public class BlackTile extends NonPlaceableElement {
public BlackTile() {
super("LTUP-PLAC-0002", "Black Tile", "The black tile", "edu/rpi/legup/images/lightup/black.gif");
super("LTUP-UNPL-0002", "Black Tile", "The black tile", "edu/rpi/legup/images/lightup/black.gif");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package edu.rpi.legup.puzzle.lightup.elements;

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

public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super("LTUP-UNPL-0003", "Unknown Tile", "A blank tile", "edu/rpi/legup/images/lightup/UnknownTile.png");
}
}
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 97be2be

Please sign in to comment.