Changed init

This commit is contained in:
2015-06-11 12:48:42 +02:00
parent 2e24060a12
commit 7671294207
+9 -9
View File
@@ -35,6 +35,8 @@ public class PlayState extends GameState {
public static int comboScore = 0;
public static double lifePoints = 100;
private boolean init = false;
private long oldProgress = 0;
public PlayState(GameStateManager gsm, SongHandler sh) {
@@ -47,7 +49,7 @@ public class PlayState extends GameState {
@Override
public void init() {
init = true;
lifePoints = 100;
currentScore = 0;
comboScore = 0;
@@ -58,14 +60,6 @@ public class PlayState extends GameState {
p.getEnemysInPath().clear();
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
sh.play();
for (int i = 1; i < ButtonHandler.getButtons().size(); i++) {
Button b = ButtonHandler.getButton(i);
b.setColor(Color.BLACK);
@@ -73,10 +67,14 @@ public class PlayState extends GameState {
ButtonHandler.getButton(1).setColor(sh.getCurrentSongInstance().getButtons().get(0).getColor());
sh.play();
init = false;
}
@Override
public void update(float factor) {
if(init)
return;
long progress = (long) ((sh.getProgress() / 1000) + (Enemy.secondsToEnd * 1000));
@@ -90,6 +88,8 @@ public class PlayState extends GameState {
p.addEnemy(ob.getColor(), ob.getDirection(), (int) ob.getLength());
}
// System.out.println(progress - oldProgress + " / " + area.paths.get(player.getIndex()).getEnemysInPath().size());
oldProgress = progress;
player.update(factor);