Add spawn-Rules to LevelConfigParser feature set.
This commit is contained in:
parent
4e5d6bcd52
commit
d2e28477f0
|
@ -1,10 +1,11 @@
|
||||||
name:Lustiger Levelname
|
name:Lustiger Levelname
|
||||||
backgroundMusic:music/bla.wav
|
backgroundMusic:music/bla.wav
|
||||||
background:FooBackground
|
background:FooBackground
|
||||||
bossEnemy:TheBigOne
|
|
||||||
-
|
-
|
||||||
[0-2025]
|
[0-2025]
|
||||||
spawn:GegnerOne,2,6
|
spawn:GegnerOne,2,6
|
||||||
[2026-2168]
|
[2026-2168]
|
||||||
spawn:GegnerOne,2,4
|
spawn:GegnerOne,2,4
|
||||||
spawn:GegnerTwo,5,6
|
spawn:GegnerTwo,5,6
|
||||||
|
[2169-2170]
|
||||||
|
spawn:BossGegner,1,1
|
|
@ -9,10 +9,6 @@ import de.teamteamteam.spacescooter.entity.enemy.EnemyBoss;
|
||||||
import de.teamteamteam.spacescooter.entity.enemy.EnemyFour;
|
import de.teamteamteam.spacescooter.entity.enemy.EnemyFour;
|
||||||
import de.teamteamteam.spacescooter.entity.enemy.EnemyThree;
|
import de.teamteamteam.spacescooter.entity.enemy.EnemyThree;
|
||||||
import de.teamteamteam.spacescooter.entity.item.ItemChance;
|
import de.teamteamteam.spacescooter.entity.item.ItemChance;
|
||||||
import de.teamteamteam.spacescooter.gui.HealthBar;
|
|
||||||
import de.teamteamteam.spacescooter.gui.InterfaceBar;
|
|
||||||
import de.teamteamteam.spacescooter.gui.ScoreBar;
|
|
||||||
import de.teamteamteam.spacescooter.gui.ShieldBar;
|
|
||||||
import de.teamteamteam.spacescooter.screen.GameScreen;
|
import de.teamteamteam.spacescooter.screen.GameScreen;
|
||||||
import de.teamteamteam.spacescooter.utility.Loader;
|
import de.teamteamteam.spacescooter.utility.Loader;
|
||||||
|
|
||||||
|
@ -44,6 +40,7 @@ public final class Level {
|
||||||
* Initialize the level based on the LevelConfig attributes.
|
* Initialize the level based on the LevelConfig attributes.
|
||||||
*/
|
*/
|
||||||
public void doBuildUp() {
|
public void doBuildUp() {
|
||||||
|
new StarBackground(0, 50);
|
||||||
GameScreen.setPlayer(new Player(200, 300));
|
GameScreen.setPlayer(new Player(200, 300));
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,9 +51,6 @@ public final class Level {
|
||||||
points.add(new Point(0,500));
|
points.add(new Point(0,500));
|
||||||
new EnemyFour(800, 400, points);
|
new EnemyFour(800, 400, points);
|
||||||
|
|
||||||
new StarBackground(0, 50);
|
|
||||||
|
|
||||||
|
|
||||||
new EnemyThree(450, 100);
|
new EnemyThree(450, 100);
|
||||||
new EnemyBoss(200, 300);
|
new EnemyBoss(200, 300);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,13 @@ public class LevelConfigParser {
|
||||||
this.currentIntervalEnd = Integer.parseInt(intervalBorder[1]);
|
this.currentIntervalEnd = Integer.parseInt(intervalBorder[1]);
|
||||||
this.levelConfig.addIntervalToList(this.currentIntervalStart, this.currentIntervalEnd);
|
this.levelConfig.addIntervalToList(this.currentIntervalStart, this.currentIntervalEnd);
|
||||||
} else {
|
} else {
|
||||||
String[] entitySpawnRule = line.split(",", 3);
|
String[] rule = line.split(":", 2);
|
||||||
|
if(rule[0].equals("spawn")) {
|
||||||
|
String[] entitySpawnRule = rule[1].split(",", 3);
|
||||||
this.levelConfig.addEntitySpawnRule(this.currentIntervalStart, this.currentIntervalEnd, entitySpawnRule[0], Integer.parseInt(entitySpawnRule[1]), Integer.parseInt(entitySpawnRule[2]));
|
this.levelConfig.addEntitySpawnRule(this.currentIntervalStart, this.currentIntervalEnd, entitySpawnRule[0], Integer.parseInt(entitySpawnRule[1]), Integer.parseInt(entitySpawnRule[2]));
|
||||||
|
} else {
|
||||||
|
System.err.println("Unknown rule type: '"+rule[0]+"' : '"+line+"'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue