master
Jonathan Hager 6 years ago
parent b1dd3b6631
commit f45ef144b8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -66,7 +66,7 @@ public class GameScreen {
//Inventory TEST
float animationSpeed = 0.1f;
public GameScreen(Dungeon d, float volume) {
//CONTROLS
@ -103,7 +103,13 @@ public class GameScreen {
camera = new OrthographicCamera(1, h/w);
camera.translate(175f, 215f);
MapGenerator mg = new MapGenerator(new Texture(Gdx.files.internal("tilesets/tileset_floor_1.png")));
Texture[] tempTextures = new Texture[d.getLevel().length];
for(int i = 0; i < tempTextures.length; i++){
int j = i+1;
tempTextures[i] = new Texture(Gdx.files.internal("tilesets/tileset_floor_" + j + ".png"));
}
MapGenerator mg = new MapGenerator(tempTextures);
m = mg.generateMap(d);
mg.ichWillSpielen(m.getMaps());
@ -138,7 +144,7 @@ public class GameScreen {
player.updateWalking();
}
}
}, 0, 0.1f);
}, 0, animationSpeed);
//Inventory TEST

@ -24,15 +24,17 @@ import com.dungeoncrawler.model.Room;
* @author jonathan
*/
public class MapGenerator {
Texture tiles;
TextureRegion[][][] allTiles;
TextureRegion[][] splitTiles;
Texture torchT;
Texture sword;
public MapGenerator(Texture tiles){
this.tiles = tiles;
splitTiles = TextureRegion.split(this.tiles, 48, 48);
public MapGenerator(Texture[] tiles){
allTiles = new TextureRegion[7][][];
for(int i = 0; i < tiles.length; i++){
allTiles[i] = TextureRegion.split(tiles[i], 48, 48);
}
torchT = new Texture("sprites/torch.png");
sword = new Texture("sprites/sword.png");
}
@ -56,6 +58,8 @@ public class MapGenerator {
private MapContainer[][] generateLevel(int i, Level l){
splitTiles = allTiles[i];
int sizeX = l.getRooms().length;
int sizeY = l.getRooms()[0].length;
@ -205,18 +209,6 @@ public class MapGenerator {
TiledMap tempRoom = new TiledMap();
MapContainer temp = new MapContainer(tempRoom);
int bodenX;
int bodenY;
if(lvl < 5){
bodenX = lvl;
bodenY = 0;
}
else{
bodenX = 0;
bodenY = lvl - 4;
}
// roomDimension bezieht sich auf die Größe des Raumes, da aber noch die Wände fehlen,
// muss auf die Größe jeweils 2 addiert werden.
int mapDimensionX = roomDimensionX + 2;
@ -284,7 +276,7 @@ public class MapGenerator {
cell.setTile(new StaticTiledMapTile(splitTiles[4][3]));
}
else{
cell.setTile(new StaticTiledMapTile(splitTiles[bodenX][bodenY]));
cell.setTile(new StaticTiledMapTile(splitTiles[0][0]));
}
// Ecken

Loading…
Cancel
Save