Stone Texture floor added

+ added into corridor
This commit is contained in:
Malin.sieckmann
2021-06-24 14:44:37 +02:00
parent 3b424d4c98
commit 7aa013cc7f
6 changed files with 11 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ public class Tile extends Knoten {
public static final int WALL_BOTTOM = 2; public static final int WALL_BOTTOM = 2;
public static final int STONE_WALL = 3; public static final int STONE_WALL = 3;
public static final int STONE_WALL_BOTTOM = 4; public static final int STONE_WALL_BOTTOM = 4;
public static final int STONE_FLOOR = 5;
private Bild img; // Bild, das gerendert wird private Bild img; // Bild, das gerendert wird
private int id; // Die id dises Tiles private int id; // Die id dises Tiles
@@ -39,11 +40,15 @@ public class Tile extends Knoten {
if (id == GRASS) { if (id == GRASS) {
buff = buff.getSubimage(16 * (int) (Math.random() * 8), 0, 16, 16); 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 // Skalieren
BufferedImage scaled = new BufferedImage(World.SCALE, World.SCALE, BufferedImage.TYPE_INT_RGB); BufferedImage scaled = new BufferedImage(World.SCALE, World.SCALE, BufferedImage.TYPE_INT_RGB);
scaled.getGraphics().drawImage(buff, 0, 0, World.SCALE, World.SCALE, null); scaled.getGraphics().drawImage(buff, 0, 0, World.SCALE, World.SCALE, null);
img = new Bild(x * World.SCALE, y * World.SCALE, scaled); img = new Bild(x * World.SCALE, y * World.SCALE, scaled);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -63,9 +68,11 @@ public class Tile extends Knoten {
case WALL_BOTTOM: case WALL_BOTTOM:
return "/res/images/tiles/wall_bottom.png"; return "/res/images/tiles/wall_bottom.png";
case STONE_WALL: case STONE_WALL:
return "/res/images/tiles/stone_wall.png"; return "/res/images/tiles/test.png";
case STONE_WALL_BOTTOM: case STONE_WALL_BOTTOM:
return "/res/images/tiles/stone_wall_bottom.png"; return "/res/images/tiles/stone_wall_bottom.png";
case STONE_FLOOR:
return "/res/images/tiles/Stone_floor.png";
} }
return null; return null;
} }

View File

@@ -21,23 +21,11 @@ public class World extends Knoten {
public World() { public World() {
// Map initialisieren // Map initialisieren
currentMap = new TestMap(); currentMap = new Corridor();
// Map zu EA hinzufügen // Map zu EA hinzufügen
add(currentMap); add(currentMap);
// und Entities auch
Player player = new Player();
add(player.actionFigur);
currentMap.getEntities().add(player);
Spider spider = new Spider();
// und Spinnen auch
add(spider.actionFigur);
currentMap.getEntities().add(spider);
Snake snake = new Snake();
add(snake.actionFigur);
currentMap.getEntities().add(snake);
// Alle Entities als ticker registrieren (triggert dann die update methoden) // Alle Entities als ticker registrieren (triggert dann die update methoden)
for (Entity e : currentMap.getEntities()) { for (Entity e : currentMap.getEntities()) {

View File

@@ -17,7 +17,7 @@ public class Corridor extends Map {
add(map[x][y]); add(map[x][y]);
} }
else { else {
map[x][y] = new Tile(0, x, y); map[x][y] = new Tile(5, x, y);
add(map[x][y]); add(map[x][y]);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 540 B