This commit is contained in:
Bilel Bghiel
2015-07-09 13:36:27 +02:00
6 changed files with 205 additions and 10 deletions
+17 -4
View File
@@ -9,7 +9,6 @@ import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.Iterator;
import main.Window;
import model.SongHandler;
import model.drawObjects.Enemy;
import model.drawObjects.Player;
@@ -17,6 +16,7 @@ import model.drawObjects.PointAnimation;
import model.objects.InfoPanel;
import model.objects.Path;
import model.objects.PlayArea;
import model.objects.highscore.Highscore;
import audio.ButtonInstance;
import audio.ObjectInstance;
import control.GameStateManager;
@@ -47,6 +47,7 @@ public class PlayState extends GameState {
private int joystick_moved = 0;
private boolean init = false;
private static boolean won = false;
private long oldProgress = 0;
@@ -62,6 +63,7 @@ public class PlayState extends GameState {
@Override
public void init() {
init = true;
won = false;
lifePoints = 100;
currentScore = 0;
comboScore = 0;
@@ -71,6 +73,9 @@ public class PlayState extends GameState {
enemies_missed = 0;
buttons_pressed = 0;
joystick_moved = 0;
Highscore h = sql.getHighscore(sh.getCurrentSong(), sh.getCurrentSongInstance());
if(h != null)
infoPanel.init(h.getScore());
infoPanel.init(sql.getHighscore(sh.getCurrentSong(), sh.getCurrentSongInstance()).getScore());
@@ -103,8 +108,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;
@@ -166,7 +174,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
@@ -229,6 +237,7 @@ public class PlayState extends GameState {
}
}
}
player.setBeat();
@@ -291,5 +300,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;
}
}