If you not die you win
This commit is contained in:
@@ -45,6 +45,7 @@ public class PlayState extends GameState {
|
||||
private int joystick_moved = 0;
|
||||
|
||||
private boolean init = false;
|
||||
private static boolean won = false;
|
||||
|
||||
private long oldProgress = 0;
|
||||
|
||||
@@ -60,6 +61,7 @@ public class PlayState extends GameState {
|
||||
@Override
|
||||
public void init() {
|
||||
init = true;
|
||||
won = false;
|
||||
lifePoints = 100;
|
||||
currentScore = 0;
|
||||
comboScore = 0;
|
||||
@@ -104,8 +106,11 @@ public class PlayState extends GameState {
|
||||
}
|
||||
|
||||
|
||||
if(progress > sh.getCurrentSongInstance().getEndTime() + Enemy.secondsToEnd*1000*2)
|
||||
endGame();
|
||||
if(progress > sh.getCurrentSongInstance().getEndTime() + Enemy.secondsToEnd*1000*2){
|
||||
won = true;
|
||||
endGame();
|
||||
}
|
||||
|
||||
|
||||
oldProgress = progress;
|
||||
|
||||
@@ -157,7 +162,7 @@ public class PlayState extends GameState {
|
||||
}
|
||||
}
|
||||
|
||||
private void endGame() {
|
||||
private void endGame() {
|
||||
if(sh.getProgress()/1000 > 5000)
|
||||
{
|
||||
sql.addPlaydata(sh.getCurrentSong(), sh.getCurrentSongInstance(), sh.getProgress()/1000, enemies_missed, enemies_hit, buttons_pressed, joystick_moved);
|
||||
@@ -167,7 +172,7 @@ public class PlayState extends GameState {
|
||||
if(currentScore == 0)
|
||||
gsm.setState(State.MENU_STATE);
|
||||
else
|
||||
gsm.setState(State.GAMEOVER_STATE);
|
||||
gsm.setState(State.END_STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,5 +295,9 @@ public class PlayState extends GameState {
|
||||
Path path = area.paths.get(pathID);
|
||||
Enemy e = new Enemy(pathID, 1, color, path);
|
||||
path.getEnemysInPath().addLast(e);
|
||||
}
|
||||
|
||||
public static boolean won(){
|
||||
return won;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user