diff --git a/cicaprojekt/Stargate.java b/cicaprojekt/Stargate.java index 4066cd8..8f6e900 100644 --- a/cicaprojekt/Stargate.java +++ b/cicaprojekt/Stargate.java @@ -59,7 +59,9 @@ public class Stargate { return isSpawned; } public boolean isOpen() { - return isSpawned & other.isSpawned; + if(isSpawned & other.isSpawned) + return other.getCurrentWall().getAdjacentTile(other.getExitDirection()).isSteppable(); + return false; } private Direction getExitDirection() { @@ -69,6 +71,8 @@ public class Stargate { public void teleport(PlayerBase player) { if(isOpen()) player.setCurrentTile(other.getCurrentWall().getAdjacentTile(other.getExitDirection())); + else + player.setCurrentTile(this.getCurrentWall()); } @Override diff --git a/cicaprojekt/Wall.java b/cicaprojekt/Wall.java index 3b3567c..c100da8 100644 --- a/cicaprojekt/Wall.java +++ b/cicaprojekt/Wall.java @@ -44,6 +44,7 @@ public class Wall extends Tile { } public void onExit(PlayerBase playerBase) throws IllegalStateException { + if(sg != null) return; throw new IllegalStateException("Hiba! Te hogy kerültél a falba?"); }