Add Background to configurable items.

This commit is contained in:
Jan Philipp Timme 2014-11-25 14:31:35 +01:00
parent c8b8c2fd79
commit c005120053
3 changed files with 5 additions and 4 deletions

View File

@ -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]

View File

@ -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;

View File

@ -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!");