This commit is contained in:
Asecave
2021-06-18 17:03:18 +02:00
parent bc4106efba
commit 059ceb7097
87 changed files with 139566 additions and 320 deletions

View File

@@ -11,8 +11,8 @@ public class Map extends Knoten {
for (int x = 0; x < map.length; x++) {
for (int y = 0; y < map[0].length; y++) {
map[x][y] = new Tile((x == 0 || y == 0 || x == map.length - 1 || y == map[0].length - 1) ? 1 : 0);
map[x][y].setX(x * 96);
map[x][y].setY(y * 96);
map[x][y].setX(x * Tile.getSize());
map[x][y].setY(y * Tile.getSize());
add(map[x][y]);
}
}

View File

@@ -1,27 +1,59 @@
package main;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import ea.Bild;
import ea.Knoten;
public class Tile extends Knoten {
public static final int GRASS = 0;
public static final int WALL = 1;
private static final int SCALE = 6;
private Bild img;
public Tile(int id) {
img = new Bild(getPathFromId(id));
try {
BufferedImage buff = ImageIO.read(Tile.class.getResourceAsStream(getPathFromId(id)));
if (id == GRASS) {
buff = buff.getSubimage(16 * (int) (Math.random() * 8), 0, 16, 16);
}
BufferedImage after = new BufferedImage(buff.getWidth() * SCALE, buff.getHeight() * SCALE, BufferedImage.TYPE_INT_ARGB);
AffineTransform at = new AffineTransform();
at.scale(SCALE, SCALE);
AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
after = scaleOp.filter(buff, after);
int x = 0;
int y = 0;
if (id == WALL) {
y = -after.getHeight() + 16 * SCALE;
}
img = new Bild(x, y, after);
} catch (IOException e) {
e.printStackTrace();
}
add(img);
}
private String getPathFromId(int id) {
switch (id) {
case GRASS:
return "res/images/grass.png";
return "/res/images/tiles/grass.png";
case WALL:
return "res/images/stone.png";
return "/res/images/tiles/wall.png";
}
return null;
}
public static int getSize() {
return 16 * SCALE;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@
Music by Eric Matyas
http://soundimage.org