diff --git a/cicaprojekt/Gate.java b/cicaprojekt/Gate.java index 2a56dc1..16203f8 100644 --- a/cicaprojekt/Gate.java +++ b/cicaprojekt/Gate.java @@ -12,6 +12,12 @@ public class Gate extends Tile { if (this.open) adjacentTile.get(direction).spawnStargate(stargate, direction); } + @Override + public boolean boxPermission() + { + return open; + } + @Override public void onEntry(PlayerBase playerBase) { super.onEntry(playerBase); diff --git a/cicaprojekt/Player.java b/cicaprojekt/Player.java index f340f4e..355e9f0 100644 --- a/cicaprojekt/Player.java +++ b/cicaprojekt/Player.java @@ -32,7 +32,7 @@ public class Player extends PlayerBase { public void boxDrop() { if(!isDestroyed()) { Tile target = currentTile.getAdjacentTile(facingDirection); - if (target.isSteppable()) { + if (target.boxPermission()) { target.putABox(boxLifted); boxLifted = null; } diff --git a/cicaprojekt/Tile.java b/cicaprojekt/Tile.java index 49ba604..05c5c71 100644 --- a/cicaprojekt/Tile.java +++ b/cicaprojekt/Tile.java @@ -93,4 +93,8 @@ public abstract class Tile { public boolean hasBox() { return !boxStack.isEmpty(); } + + public boolean boxPermission() { + return true; + } } diff --git a/cicaprojekt/Wall.java b/cicaprojekt/Wall.java index d23cc44..da83b70 100644 --- a/cicaprojekt/Wall.java +++ b/cicaprojekt/Wall.java @@ -30,6 +30,12 @@ public class Wall extends Tile { } } + @Override + public boolean boxPermission() + { + return false; + } + @Override public void onEntry(PlayerBase playerBase) { super.onEntry(playerBase);