- Degelijke pre state integratie.
- Help state naar volledigheid geintegreerd.
This commit is contained in:
@@ -5,12 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import model.SongHandler;
|
||||
import model.gameState.GameOverState;
|
||||
import model.gameState.GameState;
|
||||
import model.gameState.HelpState;
|
||||
import model.gameState.MenuState;
|
||||
import model.gameState.PlayState;
|
||||
import model.gameState.TitleState;
|
||||
import model.gameState.*;
|
||||
import control.button.Button;
|
||||
import control.button.ButtonEvent;
|
||||
import control.button.ButtonHandler;
|
||||
@@ -35,7 +30,8 @@ public class GameStateManager {
|
||||
MENU_STATE,
|
||||
HELP_STATE,
|
||||
PLAY_STATE,
|
||||
GAMEOVER_STATE
|
||||
GAMEOVER_STATE,
|
||||
PRE_GAME_STATE
|
||||
}
|
||||
|
||||
public GameStateManager(SongHandler sh, SQLConnector sql){
|
||||
@@ -46,6 +42,7 @@ public class GameStateManager {
|
||||
gamestates.add(new HelpState(this, sh, sql));
|
||||
gamestates.add(new PlayState(this, sh, sql));
|
||||
gamestates.add(new GameOverState(this, sh, sql));
|
||||
gamestates.add(new PreGameState(this, sh, sql));
|
||||
setState(State.TITLE_STATE);
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -32,7 +32,8 @@ public class Images {
|
||||
images.add(toCompatibleImage(ImageIO.read(Main.class.getResource("/image/aanwijzers4sho.png"))));
|
||||
images.add(toCompatibleImage(ImageIO.read(Main.class.getResource("/image/kast.png"))));
|
||||
images.add(toCompatibleImage(ImageIO.read(Main.class.getResource("/image/gameover.png"))));
|
||||
images.add(toCompatibleImage(ImageIO.read(Main.class.getResource("/image/gameover.png")))); // HELP, MAAR NOG GEEN JUIST PLAATJE
|
||||
images.add(toCompatibleImage(ImageIO.read(Main.class.getResource("/image/help.png"))));
|
||||
images.add(toCompatibleImage(ImageIO.read(Main.class.getResource("/image/screenshot.png")))); // HELP, MAAR NOG GEEN JUIST PLAATJE
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -45,7 +46,8 @@ public class Images {
|
||||
public enum ImageType {
|
||||
pulse, cursor, pressstart,
|
||||
colorstrike, background, aanwijzers,
|
||||
kast, gameover, help
|
||||
kast, gameover, help,
|
||||
screenshot
|
||||
}
|
||||
|
||||
public static BufferedImage readImage(File f) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user