- Degelijke pre state integratie.

- Help state naar volledigheid geintegreerd.
This commit is contained in:
Bilel Bghiel
2015-06-22 09:51:30 +02:00
parent 6d354d0675
commit 25828bdbf9
4 changed files with 26 additions and 23 deletions
+9 -1
View File
@@ -49,6 +49,8 @@ public class PlayState extends GameState {
private boolean init = false;
private boolean prestateShown = false;
private long oldProgress = 0;
public PlayState(GameStateManager gsm, SongHandler sh, SQLConnector sql) {
@@ -89,7 +91,12 @@ public class PlayState extends GameState {
public void update(float factor) {
if(init)
return;
if (!prestateShown) {
gsm.setState(control.GameStateManager.State.PRE_GAME_STATE);
prestateShown = true;
}
long progress = (long) ((sh.getProgress() / 1000) + (Enemy.secondsToEnd * 1000));
for (ButtonInstance bu : sh.getCurrentSongInstance().getButtonsBetween(oldProgress, progress)) {
@@ -160,6 +167,7 @@ public class PlayState extends GameState {
}
comboMulitplier = 0;
prestateShown = false;
if(currentScore == 0)
gsm.setState(State.MENU_STATE);
+9 -13
View File
@@ -17,15 +17,15 @@ import control.joystick.JoystickEvent;
public class PreGameState extends GameState {
private double index2 = 3,
index = 3,
timer;
index = 3;
private int grootte = 150;
SQLConnector sql;
private SQLConnector sql;
BasicStroke s = new BasicStroke(20);
private BasicStroke s = new BasicStroke(20);
BufferedImage screenshot;
private BufferedImage screenshot;
public PreGameState(GameStateManager gsm, SongHandler sh, SQLConnector sql) {
super(gsm, sh, sql);
@@ -40,11 +40,13 @@ public class PreGameState extends GameState {
@Override
public void update(float factor) {
// timer = timer +factor/1000;
// index -= timer;
index2 -= factor/1000;
index = (double) Math.round(index2*1000)/1000;
if(index <= 0){
grootte = 150;
index = 3;
index2 = 3;
gsm.setState(control.GameStateManager.State.PLAY_STATE);
}
@@ -65,18 +67,12 @@ public class PreGameState extends GameState {
g2.drawString(text, 325, 400);
if(index < 1){
text = "GO!!!";
// width = g2.getFontMetrics().stringWidth("GO!!!");
// g2.drawString("GO!!!",325,600);
}
else if (index < 2){
text = "SET";
// width = g2.getFontMetrics().stringWidth("SET");
// g2.drawString("SET", 450,600);
}
else{
text = "READY";
// width = g2.getFontMetrics().stringWidth("READY");
// g2.drawString("READY", 325, 600);
}
width = g2.getFontMetrics().stringWidth(text);
g2.drawString(text, (256+1024/2)-width/2, 600);