diff --git a/Zoelda/src/main/DoorTile.java b/Zoelda/src/main/DoorTile.java index 5ba5fc2..172d388 100644 --- a/Zoelda/src/main/DoorTile.java +++ b/Zoelda/src/main/DoorTile.java @@ -5,7 +5,7 @@ import main.entities.player.Player; import main.maps.Map; public class DoorTile extends Tile implements Ticker { - + public static final int TOP = 0; public static final int BOTTOM = 1; public static final int LEFT = 2; @@ -28,7 +28,9 @@ public class DoorTile extends Tile implements Ticker { float dist = player.dist(posX + 0.5f, posY + 0.5f); if (dist < 0.5f) { if (!waitForLeave) { - Main.instance.getWorld().changeMap(this); + if (connected != null) { + Main.instance.getWorld().changeMap(this); + } } } else { waitForLeave = false; @@ -43,11 +45,11 @@ public class DoorTile extends Tile implements Ticker { public void setSide(int side) { this.side = side; } - + public void setConnectedDoor(DoorTile door) { connected = door; } - + public DoorTile getConnectedDoor() { return connected; } @@ -59,7 +61,7 @@ public class DoorTile extends Tile implements Ticker { public void waitForLeave() { waitForLeave = true; } - + @Override public DoorTile clone() { DoorTile t = new DoorTile(getID(), posX, posY, map); diff --git a/Zoelda/src/main/maps/ImageMap.java b/Zoelda/src/main/maps/ImageMap.java index 4be00d9..5104c42 100644 --- a/Zoelda/src/main/maps/ImageMap.java +++ b/Zoelda/src/main/maps/ImageMap.java @@ -52,7 +52,7 @@ public class ImageMap extends Map { } if (id == Tile.DOOR_RIGHT ) { DoorTile door = new DoorTile(id, x, y, this); - leftDoor = door; + rightDoor = door; door.setSide(DoorTile.RIGHT); tiles[x][y] = door; add(tiles[x][y]); @@ -60,7 +60,7 @@ public class ImageMap extends Map { } if (id == Tile.DOOR_TOP) { DoorTile door = new DoorTile(id, x, y, this); - leftDoor = door; + topDoor = door; door.setSide(DoorTile.TOP); tiles[x][y] = door; add(tiles[x][y]); @@ -68,7 +68,7 @@ public class ImageMap extends Map { } if (id == Tile.DOOR_BOTTOM) { DoorTile door = new DoorTile(id, x, y, this); - leftDoor = door; + bottomDoor = door; door.setSide(DoorTile.BOTTOM); tiles[x][y] = door; add(tiles[x][y]); diff --git a/Zoelda/src/main/worlds/TestWorld.java b/Zoelda/src/main/worlds/TestWorld.java index da2a681..dadf214 100644 --- a/Zoelda/src/main/worlds/TestWorld.java +++ b/Zoelda/src/main/worlds/TestWorld.java @@ -10,7 +10,7 @@ public class TestWorld extends World { super(4); Map m2 = maps[3].clone(); - getCurrentMap().connectDoors(getCurrentMap().leftDoor, m2.leftDoor); + getCurrentMap().connectDoors(getCurrentMap().bottomDoor, m2.topDoor); for (int i = 0; i < 15; i++) { Coin c = new Coin(); diff --git a/Zoelda/src/res/images/maps/map0a.png b/Zoelda/src/res/images/maps/map0a.png index 8ff991a..791cf97 100644 Binary files a/Zoelda/src/res/images/maps/map0a.png and b/Zoelda/src/res/images/maps/map0a.png differ diff --git a/Zoelda/src/res/images/maps/map1a.png b/Zoelda/src/res/images/maps/map1a.png index e6b351e..021cc98 100644 Binary files a/Zoelda/src/res/images/maps/map1a.png and b/Zoelda/src/res/images/maps/map1a.png differ diff --git a/Zoelda/src/res/images/maps/map2a.png b/Zoelda/src/res/images/maps/map2a.png index f0fe7ae..b609d71 100644 Binary files a/Zoelda/src/res/images/maps/map2a.png and b/Zoelda/src/res/images/maps/map2a.png differ diff --git a/Zoelda/src/res/images/maps/map4a.png b/Zoelda/src/res/images/maps/map4a.png index f218414..5d545ef 100644 Binary files a/Zoelda/src/res/images/maps/map4a.png and b/Zoelda/src/res/images/maps/map4a.png differ diff --git a/Zoelda/src/res/images/maps/map5a.png b/Zoelda/src/res/images/maps/map5a.png index 95e23b7..2848ff6 100644 Binary files a/Zoelda/src/res/images/maps/map5a.png and b/Zoelda/src/res/images/maps/map5a.png differ diff --git a/Zoelda/src/res/images/maps/map6a.png b/Zoelda/src/res/images/maps/map6a.png index afcc9e0..3edae5f 100644 Binary files a/Zoelda/src/res/images/maps/map6a.png and b/Zoelda/src/res/images/maps/map6a.png differ