Implemented teleport in Stargate
This commit is contained in:
parent
2f5f93dd86
commit
9013bd44d7
@ -35,7 +35,19 @@ public class Stargate {
|
||||
return isSpawned & other.isSpawned;
|
||||
}
|
||||
|
||||
public void teleport(Direction incomingDirection) {
|
||||
private Direction getExitDirection() {
|
||||
if(currentWall.getAdjacentTile(Direction.EAST) == null)
|
||||
return Direction.WEST;
|
||||
else if(currentWall.getAdjacentTile(Direction.WEST) == null)
|
||||
return Direction.EAST;
|
||||
else if(currentWall.getAdjacentTile(Direction.NORTH) == null)
|
||||
return Direction.SOUTH;
|
||||
else
|
||||
return Direction.NORTH;
|
||||
}
|
||||
|
||||
public void teleport(PlayerBase player) {
|
||||
player.setCurrentTile(other.getCurrentWall().getAdjacentTile(getExitDirection()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user