left door added/ improved, 3D wall added, shadow added

This commit is contained in:
Malin.sieckmann 2021-06-28 21:45:51 +02:00
parent 23eba51e5c
commit 657c7bab9e
23 changed files with 29 additions and 11 deletions

View File

@ -22,9 +22,12 @@ public class Tile extends Knoten {
public static final int STONE_WALL_BOTTOM = 4;
public static final int STONE_FLOOR = 5;
public static final int DOOR = 6;
public static final int STONE_FLOOR_SHADOW_LEFT = 7;
public static final int DOOR_LEFT_BOTTOM = 8;
public static final int DOOR_LEFT_TOP = 9;
private Bild img; // Bild, das gerendert wird
private int id; // Die id dises Tiles
private int id; // Die id dises Tiles//
protected float posX, posY; // Position dieses Tiles
private static Bild[] images;
@ -53,7 +56,7 @@ public class Tile extends Knoten {
}
private static void loadImages() {
images = new Bild[7];
images = new Bild[10];
for (int i = 0; i < images.length; i++) {
try {
BufferedImage buff = ImageIO.read(Tile.class.getResourceAsStream(getPathFromId(i)));
@ -62,9 +65,6 @@ public class Tile extends Knoten {
if (i == GRASS) {
buff = buff.getSubimage(16 * (int) (Math.random() * 8), 0, 16, 16);
}
// if (id == STONE_FLOOR) {
// buff = buff.getSubimage(16 * (int) (Math.random() * 10), 0, 16, 16);
// }
// Skalieren
BufferedImage scaled = new BufferedImage(World.SCALE, World.SCALE, BufferedImage.TYPE_INT_RGB);
scaled.getGraphics().drawImage(buff, 0, 0, World.SCALE, World.SCALE, null);
@ -93,7 +93,13 @@ public class Tile extends Knoten {
case STONE_FLOOR:
return "/res/images/tiles/TestTest.png";
case DOOR:
return "/res/images/tiles/door.png";
return "/res/images/tiles/door_left_bottom.png";
case STONE_FLOOR_SHADOW_LEFT:
return "/res/images/tiles/stone_floor_shadow_left.png";
case DOOR_LEFT_BOTTOM:
return "/res/images/tiles/door_left_bottom.png";
case DOOR_LEFT_TOP:
return "/res/images/tiles/door_left_top.png";
}
return null;
}

View File

@ -24,7 +24,7 @@ public class World extends Knoten {
dungeon = new ArrayList<>(50);
ImageMap start = new ImageMap("/res/images/maps/map2.png");
ImageMap start = new ImageMap("/res/images/maps/map2a.png");
dungeon.add(start);
currentMap = start;
currentMap.start();

View File

@ -13,9 +13,13 @@ import main.Tile;
public class ImageMap extends Map {
//Erstellung der abzulesenden Tiles (einem Tile wird eine farbe zugewiesen)
private static PixelTile[] pixels = { new PixelTile(Tile.STONE_WALL, new Color(100, 100, 100)),
new PixelTile(Tile.STONE_FLOOR, new Color(127, 127, 127)), new PixelTile(Tile.VOID, new Color(0, 0, 0)),
new PixelTile(Tile.DOOR, new Color(255, 0, 0)) };
new PixelTile(Tile.DOOR, new Color(255, 0, 0)), new PixelTile(Tile.DOOR_LEFT_TOP, new Color(255, 150, 0)) ,
new PixelTile(Tile.DOOR_LEFT_BOTTOM, new Color(69, 150, 0)), new PixelTile(Tile.STONE_WALL_BOTTOM, new Color(145, 145, 145)),
new PixelTile(Tile.STONE_FLOOR_SHADOW_LEFT, new Color(251, 251, 129))};
public DoorTile topDoor;
public DoorTile leftDoor;
@ -27,7 +31,8 @@ public class ImageMap extends Map {
static {
maps = new ImageMap[8];
for (int i = 0; i < maps.length; i++) {
maps[i] = new ImageMap("/res/images/maps/map" + (i + 1) + ".png");
System.out.println("/res/images/maps/map" + (i + 1) + "a.png");
maps[i] = new ImageMap("/res/images/maps/map" + (i + 1) + "a.png");
}
}
@ -49,7 +54,14 @@ public class ImageMap extends Map {
break;
}
}
if (id == Tile.DOOR) {
if (id == Tile.DOOR_LEFT_BOTTOM) {
DoorTile door = new DoorTile(x, y, this);
tiles[x][y] = door;
leftDoor = door;
door.setSide(DoorTile.LEFT);
}
if (id == Tile.DOOR ) {
DoorTile door = new DoorTile(x, y, this);
tiles[x][y] = door;
if (x == 7) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 450 B