Added DoorTiles Textures
This commit is contained in:
parent
58a41725eb
commit
dc9a08c9ee
|
@ -26,6 +26,9 @@ public class Tile extends Knoten {
|
|||
public static final int DOOR_LEFT_BOTTOM = 7;
|
||||
public static final int DOOR_LEFT_TOP = 8;
|
||||
public static final int DISCO = 9;
|
||||
public static final int DOOR_RIGHT_BOTTOM = 10;
|
||||
public static final int DOOR_TOP = 11;
|
||||
public static final int DOOR_BOTTOM = 12;
|
||||
|
||||
private Bild img; // Bild, das gerendert wird
|
||||
private int id; // Die id dises Tiles//
|
||||
|
@ -51,17 +54,17 @@ public class Tile extends Knoten {
|
|||
if (id != VOID) {
|
||||
img = images[id].clone();
|
||||
img.positionSetzen(posX * World.SCALE, posY * World.SCALE);
|
||||
// Bild zu EA hinzufügen.
|
||||
// Bild zu EA hinzuf<EFBFBD>gen.
|
||||
add(img);
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadImages() {
|
||||
images = new Bild[9];
|
||||
images = new Bild[12];
|
||||
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ällig ausgewählt werden
|
||||
// Gras hat 8 verschiedene Texturen von denen eine zuf<EFBFBD>llig ausgew<EFBFBD>hlt werden
|
||||
// muss.
|
||||
if (i == GRASS) {
|
||||
buff = buff.getSubimage(16 * (int) (Math.random() * 8), 0, 16, 16);
|
||||
|
@ -77,7 +80,7 @@ public class Tile extends Knoten {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return den Pfad der zu der Id gehört.
|
||||
* @return den Pfad der zu der Id geh<EFBFBD>rt.
|
||||
*/
|
||||
private static String getPathFromId(int id) {
|
||||
switch (id) {
|
||||
|
@ -101,12 +104,19 @@ public class Tile extends Knoten {
|
|||
return "/res/images/tiles/door_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:
|
||||
return "/res/images/tiles/door_right.png";
|
||||
case DOOR_BOTTOM:
|
||||
return "/res/images/tiles/door_bottom.png";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return die Größe der Textur
|
||||
* @return die Gr<EFBFBD><EFBFBD>e der Textur
|
||||
*/
|
||||
private static int getSize() {
|
||||
return 16;
|
||||
|
@ -116,34 +126,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üssen hier true zurückgeben,
|
||||
// sonst werden sie bei der Collisiondetection nicht berücksichtigt.
|
||||
// Alle Tiles durch die man nicht laufen soll m<EFBFBD>ssen hier true zur<EFBFBD>ckgeben,
|
||||
// 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ückzugenben.
|
||||
* Kleine Hifsmethode un die koordinate der Top-Kante rur<EFBFBD>ckzugenben.
|
||||
*/
|
||||
public int getTop() {
|
||||
return positionY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleine Hifsmethode un die koordinate der Bottom-Kante rurückzugenben.
|
||||
* Kleine Hifsmethode un die koordinate der Bottom-Kante rur<EFBFBD>ckzugenben.
|
||||
*/
|
||||
public int getBottom() {
|
||||
return positionY() + getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleine Hifsmethode un die koordinate der Left-Kante rurückzugenben.
|
||||
* Kleine Hifsmethode un die koordinate der Left-Kante rur<EFBFBD>ckzugenben.
|
||||
*/
|
||||
public int getLeft() {
|
||||
return positionX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kleine Hifsmethode un die koordinate der Right-Kante rurückzugenben.
|
||||
* Kleine Hifsmethode un die koordinate der Right-Kante rur<EFBFBD>ckzugenben.
|
||||
*/
|
||||
public int getRight() {
|
||||
return positionX() + getSize();
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 232 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 260 B |
Binary file not shown.
After Width: | Height: | Size: 478 B |
Binary file not shown.
After Width: | Height: | Size: 338 B |
Binary file not shown.
After Width: | Height: | Size: 351 B |
Loading…
Reference in New Issue