Added DoorTiles Textures
This commit is contained in:
@@ -26,6 +26,9 @@ public class Tile extends Knoten {
|
|||||||
public static final int DOOR_LEFT_BOTTOM = 7;
|
public static final int DOOR_LEFT_BOTTOM = 7;
|
||||||
public static final int DOOR_LEFT_TOP = 8;
|
public static final int DOOR_LEFT_TOP = 8;
|
||||||
public static final int DISCO = 9;
|
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 Bild img; // Bild, das gerendert wird
|
||||||
private int id; // Die id dises Tiles//
|
private int id; // Die id dises Tiles//
|
||||||
@@ -51,17 +54,17 @@ public class Tile extends Knoten {
|
|||||||
if (id != VOID) {
|
if (id != VOID) {
|
||||||
img = images[id].clone();
|
img = images[id].clone();
|
||||||
img.positionSetzen(posX * World.SCALE, posY * World.SCALE);
|
img.positionSetzen(posX * World.SCALE, posY * World.SCALE);
|
||||||
// Bild zu EA hinzufügen.
|
// Bild zu EA hinzuf<EFBFBD>gen.
|
||||||
add(img);
|
add(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadImages() {
|
private static void loadImages() {
|
||||||
images = new Bild[9];
|
images = new Bild[12];
|
||||||
for (int i = 0; i < images.length; i++) {
|
for (int i = 0; i < images.length; i++) {
|
||||||
try {
|
try {
|
||||||
BufferedImage buff = ImageIO.read(Tile.class.getResourceAsStream(getPathFromId(i)));
|
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.
|
// muss.
|
||||||
if (i == GRASS) {
|
if (i == GRASS) {
|
||||||
buff = buff.getSubimage(16 * (int) (Math.random() * 8), 0, 16, 16);
|
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) {
|
private static String getPathFromId(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
@@ -101,12 +104,19 @@ public class Tile extends Knoten {
|
|||||||
return "/res/images/tiles/door_left_top.png";
|
return "/res/images/tiles/door_left_top.png";
|
||||||
case DISCO:
|
case DISCO:
|
||||||
return "/res/images/tiles/disco_sprite_sheet.png";
|
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 null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return die Größe der Textur
|
* @return die Gr<EFBFBD><EFBFBD>e der Textur
|
||||||
*/
|
*/
|
||||||
private static int getSize() {
|
private static int getSize() {
|
||||||
return 16;
|
return 16;
|
||||||
@@ -116,34 +126,34 @@ public class Tile extends Knoten {
|
|||||||
* @return ob man durch das Tile durchgehen kann
|
* @return ob man durch das Tile durchgehen kann
|
||||||
*/
|
*/
|
||||||
public boolean isCollidable() {
|
public boolean isCollidable() {
|
||||||
// Alle Tiles durch die man nicht laufen soll müssen hier true zurückgeben,
|
// Alle Tiles durch die man nicht laufen soll m<EFBFBD>ssen hier true zur<EFBFBD>ckgeben,
|
||||||
// sonst werden sie bei der Collisiondetection nicht berücksichtigt.
|
// sonst werden sie bei der Collisiondetection nicht ber<EFBFBD>cksichtigt.
|
||||||
return id == WALL_TOP || id == STONE_WALL;
|
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() {
|
public int getTop() {
|
||||||
return positionY();
|
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() {
|
public int getBottom() {
|
||||||
return positionY() + getSize();
|
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() {
|
public int getLeft() {
|
||||||
return positionX();
|
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() {
|
public int getRight() {
|
||||||
return positionX() + getSize();
|
return positionX() + getSize();
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 232 B |
Binary file not shown.
BIN
Zoelda/src/res/images/tiles/door_bottom.png
Normal file
BIN
Zoelda/src/res/images/tiles/door_bottom.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 260 B |
BIN
Zoelda/src/res/images/tiles/door_left1.png
Normal file
BIN
Zoelda/src/res/images/tiles/door_left1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 478 B |
BIN
Zoelda/src/res/images/tiles/door_left_bottom1.png
Normal file
BIN
Zoelda/src/res/images/tiles/door_left_bottom1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 338 B |
BIN
Zoelda/src/res/images/tiles/door_right_bottom.png
Normal file
BIN
Zoelda/src/res/images/tiles/door_right_bottom.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 351 B |
Reference in New Issue
Block a user