From c005120053502f09ce77ffa7ee91873bce2764fe Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 25 Nov 2014 14:31:35 +0100 Subject: [PATCH] Add Background to configurable items. --- res/levels/test.level | 2 +- src/de/teamteamteam/spacescooter/level/Level.java | 6 ++++-- src/de/teamteamteam/spacescooter/level/LevelConfig.java | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/res/levels/test.level b/res/levels/test.level index e6bdf6e..2426e07 100644 --- a/res/levels/test.level +++ b/res/levels/test.level @@ -3,7 +3,7 @@ backgroundMusic:music/bla.wav background:StarBackground - [0-4] -spawn:EnemyBoss,1,1 +spawn:EnemyOne,1,1 [5-10] spawn:EnemyTwo,2,10 [11-25] diff --git a/src/de/teamteamteam/spacescooter/level/Level.java b/src/de/teamteamteam/spacescooter/level/Level.java index ee9fe4c..fdad64a 100644 --- a/src/de/teamteamteam/spacescooter/level/Level.java +++ b/src/de/teamteamteam/spacescooter/level/Level.java @@ -41,7 +41,6 @@ public final class Level { public Level(String levelConfig) { this.levelClock = 0; this.config = Loader.getLevelConfigByFilename(levelConfig); - System.out.println(this.config); } @@ -49,7 +48,7 @@ public final class Level { * Initialize the level based on the LevelConfig attributes. */ public void doBuildUp() { - new StarBackground(0, 50); + this.spawnEntityByAvailableName(Entity.availableNames.valueOf(this.config.background), 0, 50); GameScreen.setPlayer(new Player(200, 300)); } @@ -122,6 +121,9 @@ public final class Level { */ private void spawnEntityByAvailableName(Entity.availableNames entity, int x, int y) { switch(entity) { + case StarBackground: + new StarBackground(x, y); + break; case EnemyOne: new EnemyOne(x, y); break; diff --git a/src/de/teamteamteam/spacescooter/level/LevelConfig.java b/src/de/teamteamteam/spacescooter/level/LevelConfig.java index acd64fa..f99facd 100644 --- a/src/de/teamteamteam/spacescooter/level/LevelConfig.java +++ b/src/de/teamteamteam/spacescooter/level/LevelConfig.java @@ -104,7 +104,6 @@ public class LevelConfig { * Add a given EntitySpawnRule to the ruleList. */ public void addEntitySpawnRule(int intervalStart, int intervalEnd, String entityName, int amount, int spawnRate) { - System.out.println("Adding rule for " + intervalStart + " to " + intervalEnd + ": " + entityName + ", " + amount + ", " + spawnRate); int intervalIndex = this.getIntervalIndexByBorders(intervalStart, intervalEnd); if(intervalIndex == -1) { System.err.println("No Interval for rule found!");