Gameover toegevoegt
This commit is contained in:
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import model.SongHandler;
|
||||
import model.gameState.GameOverState;
|
||||
import model.gameState.GameState;
|
||||
import model.gameState.MenuState;
|
||||
import model.gameState.PlayState;
|
||||
@@ -22,7 +23,8 @@ public class GameStateManager {
|
||||
public enum State {
|
||||
TITLE_STATE,
|
||||
MENU_STATE,
|
||||
PLAY_STATE
|
||||
PLAY_STATE,
|
||||
GAMEOVER_STATE
|
||||
}
|
||||
|
||||
public GameStateManager(SongHandler sh){
|
||||
@@ -30,6 +32,7 @@ public class GameStateManager {
|
||||
gamestates.add(new TitleState(this, sh));
|
||||
gamestates.add(new MenuState(this, sh));
|
||||
gamestates.add(new PlayState(this, sh));
|
||||
gamestates.add(new GameOverState(this, sh));
|
||||
setState(State.TITLE_STATE);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@ public class Images {
|
||||
images.add(toCompatibleImage(ImageIO.read(Main.class.getResource("/image/background.png"))));
|
||||
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"))));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -42,7 +43,7 @@ public class Images {
|
||||
}
|
||||
|
||||
public enum ImageType {
|
||||
pulse,cursor,pressstart,colorstrike,background,aanwijzers,kast
|
||||
pulse,cursor,pressstart,colorstrike,background,aanwijzers,kast,gameover
|
||||
}
|
||||
|
||||
public static BufferedImage readImage(File f) {
|
||||
|
||||
@@ -114,7 +114,7 @@ public class PlayState extends GameState {
|
||||
lifePoints -= 0.002 * factor;
|
||||
|
||||
if(lifePoints <= 0)
|
||||
gsm.setState(State.MENU_STATE);
|
||||
gsm.setState(State.GAMEOVER_STATE);
|
||||
if(comboScore >= 100)
|
||||
{
|
||||
comboScore = 0;
|
||||
@@ -177,7 +177,7 @@ public class PlayState extends GameState {
|
||||
|
||||
if(e.getButton().getButtonID() == 0)
|
||||
{
|
||||
gsm.setState(State.MENU_STATE);
|
||||
gsm.setState(State.GAMEOVER_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import model.gameState.PlayState;
|
||||
|
||||
public class InfoPanel {
|
||||
|
||||
private String totalHighscore = "Score: 000000";
|
||||
private static String totalHighscore = "000000";
|
||||
private int x, y;
|
||||
private VolatileImage infoPanel;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class InfoPanel {
|
||||
}
|
||||
|
||||
public void updateIPanel() {
|
||||
totalHighscore = "Score: " + PlayState.currentScore;
|
||||
totalHighscore = "" + PlayState.currentScore;
|
||||
|
||||
generateInfoPanel();
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class InfoPanel {
|
||||
g2.setFont(scoreFont);
|
||||
g2.setColor(Color.ORANGE);
|
||||
|
||||
g2.drawString(totalHighscore, 25, 75);
|
||||
g2.drawString("Score: " + totalHighscore, 25, 75);
|
||||
g2.drawRect(25, 100, 200, 30);
|
||||
g2.drawRect(25, 300, 200, 700);
|
||||
g2.setColor(Color.GREEN);
|
||||
@@ -59,7 +59,7 @@ public class InfoPanel {
|
||||
g2.drawImage(infoPanel, 0, 0, 256,1024,null);
|
||||
}
|
||||
|
||||
public String getTotalHighscore()
|
||||
public static String getTotalHighscore()
|
||||
{
|
||||
return totalHighscore;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user