Add Background to configurable items.
This commit is contained in:
parent
c8b8c2fd79
commit
c005120053
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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!");
|
||||
|
|
Loading…
Reference in New Issue