diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java index 008e1ecc50a8598b5b41cd60e9125a9f50ed19a5..0c6e24ee74f5c210b61d0a9260d0f39924aaaf9b 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java @@ -47,7 +47,7 @@ public class GameSceneController implements Initializable { TileManager tileManager; //map data - String mapString = "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 " + + /*String mapString = "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 " + "4 1 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 3 " + "4 2 1 1 1 1 1 2 2 2 1 1 1 1 2 1 1 3 " + "4 1 1 1 2 2 4 3 3 1 4 3 3 3 3 2 2 3 " + @@ -64,10 +64,28 @@ public class GameSceneController implements Initializable { "4 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 1 3 " + "4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 " + "4 1 1 1 2 2 4 3 3 1 3 3 3 3 3 2 2 3 " + - "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 "; + "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ";*/ + String mapString = "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 1 9 1 9 1 9 1 9 1 9 1 9 1 9 1 9 3 " + + "4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 " + + "4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 "; int horizontalTileCount = 18; int verticalTileCount = 18; - int diffTileCount = 10; + int diffTileCount = 12; int scaledTileSize = 48; diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java index 89ed0203c17e1cd80fa2787ad0e36eff0f5dbda4..5fdfadc9be62625f04c69f44f75e373f5efc4364 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Entity/Player.java @@ -312,17 +312,17 @@ class Player implements IEntity { }*/ } isDestructible = checkTileNon_Destructible(yTile -1 -i, xTile); - if(isDestructible && (yTile < 18 && xTile <18)){ + if(isDestructible && (yTile < 18 && xTile <18 && yTile > 0 && xTile > 0)){ TileManager.tileMap[yTile -1 -i][xTile] = 8; entity.gotHit(2); } isDestructible = checkTileNon_Destructible(yTile , xTile +1 +i); - if(isDestructible && (yTile < 18 && xTile <18)){ + if(isDestructible && (yTile < 18 && xTile <18 && yTile > 0 && xTile > 0)){ TileManager.tileMap[yTile][xTile +1 +i] = 8; entity.gotHit(2); } isDestructible = checkTileNon_Destructible(yTile, xTile -1 -i); - if(isDestructible && (yTile < 18 && xTile <18)){ + if(isDestructible && (yTile < 18 && xTile <18 && yTile > 0 && xTile > 0)){ TileManager.tileMap[yTile][xTile -1 -i] = 8; entity.gotHit(2); } @@ -346,7 +346,7 @@ class Player implements IEntity { } public boolean checkTileNon_Destructible(int y, int x){ //Change it with a DestructionHandler like CollisionHandler //tileSet[xTile].getDestruction(); - if(TileManager.tileMap[y][x] != 4 && TileManager.tileMap[y][x] != 3){ + if(TileManager.tileMap[y][x] != 10 && TileManager.tileMap[y][x] != 3 && TileManager.tileMap[y][x] != 4){ return true; } return false; diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java index 29c09eef38f5ccea95f6d83dacd6d9416317026c..89303569be019a3406c020421ba4005306f9ba5b 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Map/TileManager.java @@ -52,6 +52,10 @@ public class TileManager { new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/bigbomba.png")))); tileSet[8] = TileFactory.createTile(TileType.WALKABLE,TileType.NON_DESTRUCTIBLE, new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/middlexplosion.png")))); + tileSet[9] = TileFactory.createTile(TileType.NON_WALKABLE,TileType.DESTRUCTIBLE, + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/box.png")))); + tileSet[10] = TileFactory.createTile(TileType.NON_WALKABLE,TileType.NON_DESTRUCTIBLE, + new Image(Objects.requireNonNull(getClass().getResourceAsStream("/textures/map/solidstone.png")))); } catch (Exception e) { log.error(e); }