Skip to content
Snippets Groups Projects
Commit 17ffb0e6 authored by zalavari's avatar zalavari
Browse files

SwitchableHole looks like simplefield or hole, based on its state

parent f1249c86
No related branches found
No related tags found
No related merge requests found
...@@ -20,8 +20,8 @@ public class SwitchableHole extends SimpleField { ...@@ -20,8 +20,8 @@ public class SwitchableHole extends SimpleField {
ret=super.accept(toward, w, m); ret=super.accept(toward, w, m);
} }
//this seems like an else branch, but its not
//the hole could open while super.accept was being called //the hole could open while super.accept was being called
//so it can't be an else branch
if (opened) if (opened)
{ {
m.move(this); m.move(this);
...@@ -38,11 +38,9 @@ public class SwitchableHole extends SimpleField { ...@@ -38,11 +38,9 @@ public class SwitchableHole extends SimpleField {
*/ */
public void open() public void open()
{ {
if (myMoveable!=null) if (myMoveable!=null)
myMoveable.kill(); myMoveable.kill();
opened=true; opened=true;
} }
/** /**
...@@ -62,7 +60,11 @@ public class SwitchableHole extends SimpleField { ...@@ -62,7 +60,11 @@ public class SwitchableHole extends SimpleField {
@Override @Override
public void shouldDraw(View view) public void shouldDraw(View view)
{ {
view.drawSwitchableHole(); //Ha nyitva van, rajzolunk egy lyukat is
if (opened)
view.drawHole();
//Akár nyitva van, akár nem, kirajajzoljuk a többit is.
super.shouldDraw(view); super.shouldDraw(view);
} }
......
...@@ -34,14 +34,12 @@ public class View { ...@@ -34,14 +34,12 @@ public class View {
} }
public void drawAbstract() { public void drawAbstract() {
gc.setLineWidth(2); gc.setLineWidth(1);
gc.setStroke(Color.BLUE); gc.setStroke(Color.BLUE);
gc.strokeRect(x*tileSize, y*tileSize, tileSize, tileSize); gc.strokeRect(x*tileSize, y*tileSize, tileSize, tileSize);
} }
public void drawSimpleField() { public void drawSimpleField() {
gc.setFill(Color.ALICEBLUE);
//gc.fillRect(x*tileSize, y*tileSize, tileSize, tileSize);
} }
public void drawTargetField() { public void drawTargetField() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment