door colors on maps

This commit is contained in:
Tim 2021-07-01 10:23:46 +02:00
parent e818037d75
commit af51d3776e
9 changed files with 11 additions and 9 deletions

View File

@ -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);

View File

@ -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]);

View File

@ -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();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 163 B