door textures finally added! WOOP WOOP
|
@ -23,10 +23,10 @@ public class Tile extends Knoten {
|
|||
public static final int STONE_WALL_BOTTOM = 4;
|
||||
public static final int STONE_FLOOR = 5;
|
||||
public static final int STONE_FLOOR_SHADOW_LEFT = 6;
|
||||
public static final int DOOR_LEFT_BOTTOM = 7;
|
||||
public static final int DOOR_LEFT_TOP = 8;
|
||||
public static final int DOOR_LEFT = 7;
|
||||
public static final int DOOR_RIGHT_LEFT_TOP = 8;
|
||||
public static final int DISCO = 9;
|
||||
public static final int DOOR_RIGHT_BOTTOM = 10;
|
||||
public static final int DOOR_RIGHT = 10;
|
||||
public static final int DOOR_TOP = 11;
|
||||
public static final int DOOR_BOTTOM = 12;
|
||||
|
||||
|
@ -60,11 +60,11 @@ public class Tile extends Knoten {
|
|||
}
|
||||
|
||||
private static void loadImages() {
|
||||
images = new Bild[12];
|
||||
images = new Bild[13];
|
||||
for (int i = 0; i < images.length; i++) {
|
||||
try {
|
||||
BufferedImage buff = ImageIO.read(Tile.class.getResourceAsStream(getPathFromId(i)));
|
||||
// Gras hat 8 verschiedene Texturen von denen eine zuf<EFBFBD>llig ausgew<EFBFBD>hlt werden
|
||||
// Gras hat 8 verschiedene Texturen von denen eine zufaellig ausgewaehlt werden
|
||||
// muss.
|
||||
if (i == GRASS) {
|
||||
buff = buff.getSubimage(16 * (int) (Math.random() * 8), 0, 16, 16);
|
||||
|
@ -80,7 +80,7 @@ public class Tile extends Knoten {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return den Pfad der zu der Id geh<EFBFBD>rt.
|
||||
* @return den Pfad der zu der Id gehoert.
|
||||
*/
|
||||
private static String getPathFromId(int id) {
|
||||
switch (id) {
|
||||
|
@ -91,24 +91,23 @@ public class Tile extends Knoten {
|
|||
case WALL_BOTTOM:
|
||||
return "/res/images/tiles/wall_bottom.png";
|
||||
case STONE_WALL:
|
||||
return "/res/images/tiles/test.png";
|
||||
return "/res/images/tiles/stone_wall.png";
|
||||
case STONE_WALL_BOTTOM:
|
||||
return "/res/images/tiles/stone_wall_bottom.png";
|
||||
case STONE_FLOOR:
|
||||
return "/res/images/tiles/TestTest.png";
|
||||
return "/res/images/tiles/stone_floor.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";
|
||||
case DOOR_LEFT:
|
||||
return "/res/images/tiles/door_left.png";
|
||||
case DOOR_RIGHT_LEFT_TOP:
|
||||
return "/res/images/tiles/door_right_left_top.png";
|
||||
case DISCO:
|
||||
return "/res/images/tiles/disco_sprite_sheet.png";
|
||||
return "/res/images/tiles/door_left.png";
|
||||
case DOOR_RIGHT_BOTTOM:
|
||||
return "/res/images/tiles/door_right_bottom.png";
|
||||
case DOOR_TOP:
|
||||
case DOOR_RIGHT:
|
||||
return "/res/images/tiles/door_right.png";
|
||||
case DOOR_TOP:
|
||||
return "/res/images/tiles/door_top.png";
|
||||
case DOOR_BOTTOM:
|
||||
return "/res/images/tiles/door_bottom.png";
|
||||
}
|
||||
|
@ -116,7 +115,7 @@ public class Tile extends Knoten {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return die Gr<EFBFBD><EFBFBD>e der Textur
|
||||
* @return die Groesse der Textur
|
||||
*/
|
||||
private static int getSize() {
|
||||
return 16;
|
||||
|
@ -126,34 +125,34 @@ public class Tile extends Knoten {
|
|||
* @return ob man durch das Tile durchgehen kann
|
||||
*/
|
||||
public boolean isCollidable() {
|
||||
// Alle Tiles durch die man nicht laufen soll m<EFBFBD>ssen hier true zur<EFBFBD>ckgeben,
|
||||
// Alle Tiles durch die man nicht laufen soll muessen hier true zurueckgeben,
|
||||
// sonst werden sie bei der Collisiondetection nicht ber<EFBFBD>cksichtigt.
|
||||
return id == WALL_TOP || id == STONE_WALL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleine Hifsmethode un die koordinate der Top-Kante rur<EFBFBD>ckzugenben.
|
||||
* Kleine Hifsmethode um die Koordinate der Top-Kante zurueckzugenben.
|
||||
*/
|
||||
public int getTop() {
|
||||
return positionY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleine Hifsmethode un die koordinate der Bottom-Kante rur<EFBFBD>ckzugenben.
|
||||
* Kleine Hifsmethode um die Koordinate der Bottom-Kante zurueckzugenben.
|
||||
*/
|
||||
public int getBottom() {
|
||||
return positionY() + getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleine Hifsmethode un die koordinate der Left-Kante rur<EFBFBD>ckzugenben.
|
||||
* Kleine Hifsmethode um die Koordinate der Left-Kante zurueckzugenben.
|
||||
*/
|
||||
public int getLeft() {
|
||||
return positionX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleine Hifsmethode un die koordinate der Right-Kante rur<EFBFBD>ckzugenben.
|
||||
* Kleine Hifsmethode um die Koordinate der Right-Kante zurueckzugenben.
|
||||
*/
|
||||
public int getRight() {
|
||||
return positionX() + getSize();
|
||||
|
|
|
@ -11,12 +11,16 @@ import main.Tile;
|
|||
|
||||
public class ImageMap extends Map {
|
||||
|
||||
// Erstellung der abzulesenden Tiles (einem Tile wird eine farbe zugewiesen)
|
||||
// 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_LEFT_TOP, new Color(255, 150, 0)),
|
||||
new PixelTile(Tile.DOOR_LEFT_BOTTOM, new Color(69, 150, 0)),
|
||||
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_LEFT, new Color(255, 150, 0)),
|
||||
new PixelTile(Tile.DOOR_RIGHT, new Color(69, 150, 0)),
|
||||
new PixelTile(Tile.DOOR_BOTTOM, new Color(150, 150, 0)),
|
||||
new PixelTile(Tile.DOOR_TOP, new Color(0, 147, 150)),
|
||||
new PixelTile(Tile.STONE_WALL_BOTTOM, new Color(145, 145, 145)),
|
||||
new PixelTile(Tile.STONE_FLOOR_SHADOW_LEFT, new Color(251, 251, 129)) };
|
||||
|
||||
|
@ -38,7 +42,7 @@ public class ImageMap extends Map {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (id == Tile.DOOR_LEFT_BOTTOM) {
|
||||
if (id == Tile.DOOR_LEFT) {
|
||||
DoorTile door = new DoorTile(id, x, y, this);
|
||||
leftDoor = door;
|
||||
door.setSide(DoorTile.LEFT);
|
||||
|
@ -46,6 +50,30 @@ public class ImageMap extends Map {
|
|||
add(tiles[x][y]);
|
||||
continue;
|
||||
}
|
||||
if (id == Tile.DOOR_RIGHT ) {
|
||||
DoorTile door = new DoorTile(id, x, y, this);
|
||||
leftDoor = door;
|
||||
door.setSide(DoorTile.RIGHT);
|
||||
tiles[x][y] = door;
|
||||
add(tiles[x][y]);
|
||||
continue;
|
||||
}
|
||||
if (id == Tile.DOOR_TOP) {
|
||||
DoorTile door = new DoorTile(id, x, y, this);
|
||||
leftDoor = door;
|
||||
door.setSide(DoorTile.TOP);
|
||||
tiles[x][y] = door;
|
||||
add(tiles[x][y]);
|
||||
continue;
|
||||
}
|
||||
if (id == Tile.DOOR_BOTTOM) {
|
||||
DoorTile door = new DoorTile(id, x, y, this);
|
||||
leftDoor = door;
|
||||
door.setSide(DoorTile.BOTTOM);
|
||||
tiles[x][y] = door;
|
||||
add(tiles[x][y]);
|
||||
continue;
|
||||
}
|
||||
|
||||
tiles[x][y] = new Tile(id, x, y);
|
||||
add(tiles[x][y]);
|
||||
|
|
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 192 B |
After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 478 B |
Before Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |