From 378f26fdff5a0e01b35bbff1505a44117d9f171b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sat, 14 May 2016 19:47:29 +0200 Subject: [PATCH] Closes #13. Boxes are now purrfectly stackable. --- cicaprojekt/Gate.java | 6 ++++++ cicaprojekt/Player.java | 2 +- cicaprojekt/Tile.java | 4 ++++ cicaprojekt/Wall.java | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) 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);