Feature/help
# Conflicts: # model/gameState/PlayState.java
This commit is contained in:
@@ -26,7 +26,7 @@ public class GameControl implements JoystickListener, ButtonListener, ActionList
|
||||
this.view = view;
|
||||
this.gsm = gsm;
|
||||
view.setIgnoreRepaint(true);
|
||||
update = new Timer(1000/60,this);
|
||||
update = new Timer(0,this);
|
||||
update.start();
|
||||
// Timer update = new Timer();
|
||||
// update.schedule(new TimerTask() {
|
||||
@@ -62,7 +62,10 @@ public class GameControl implements JoystickListener, ButtonListener, ActionList
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
model.update(currentTime - lastTime);
|
||||
long time = currentTime - lastTime;
|
||||
if(time > 1000/60)
|
||||
time = 1000/60;
|
||||
model.update(time);
|
||||
lastTime = currentTime;
|
||||
view.repaint();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ public class MenuState extends GameState {
|
||||
|
||||
int yPosDiffButton = 900;
|
||||
private int difSelect=0;
|
||||
Font textFont2 = new Font("OCR A Extended", Font.BOLD, 50);
|
||||
Font textFont = new Font("OCR A Extended", Font.BOLD, 50);
|
||||
Font textFontSmall = new Font("OCR A Extended", Font.BOLD, 15);
|
||||
BufferedImage aanwijzers = Images.getImage(ImageType.aanwijzers);
|
||||
int index = 0;
|
||||
|
||||
@@ -66,11 +67,19 @@ public class MenuState extends GameState {
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
ButtonHandler.getButton(1).setColor(GameModel.colors[0]);
|
||||
ButtonHandler.getButton(2).setColor(GameModel.colors[2]);
|
||||
if(subscreen)
|
||||
{
|
||||
ButtonHandler.getButton(1).setColor(GameModel.colors[0]);
|
||||
ButtonHandler.getButton(2).setColor(GameModel.colors[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ButtonHandler.getButton(1).setColor(GameModel.colors[0]);
|
||||
|
||||
ButtonHandler.getButton(5).setColor(GameModel.colors[1]);
|
||||
ButtonHandler.getButton(6).setColor(GameModel.colors[4]);
|
||||
}
|
||||
|
||||
ButtonHandler.getButton(5).setColor(GameModel.colors[1]);
|
||||
ButtonHandler.getButton(6).setColor(GameModel.colors[4]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,6 +139,7 @@ public class MenuState extends GameState {
|
||||
if(subscreen){ //Screen for Song details
|
||||
if(e.getButton().getButtonID() == 2){
|
||||
subscreen = false;
|
||||
gsm.init();
|
||||
}
|
||||
if(e.getButton().getButtonID() == 1){
|
||||
sh.close();
|
||||
@@ -138,9 +148,8 @@ public class MenuState extends GameState {
|
||||
}else{ //Screen for selecting song
|
||||
if(e.getButton().getButtonID() == 1){
|
||||
subscreen = true;
|
||||
gsm.init();
|
||||
generateSubScreenForeground();
|
||||
}else if(e.getButton().getButtonID() == 2){
|
||||
subscreen = false;
|
||||
}else if(e.getButton().getButtonID() == 5){
|
||||
sh.sort(new SortALPHA());
|
||||
oldselected = 1;
|
||||
@@ -194,7 +203,7 @@ public class MenuState extends GameState {
|
||||
Graphics2D g2 = mainScreenBackground.createGraphics();
|
||||
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2.setRenderingHints(rh);
|
||||
g2.setFont(textFont2);
|
||||
g2.setFont(textFont);
|
||||
g2.setPaint(new GradientPaint(0, 0, new Color(0,0,1, 0.6f),1280,1024 ,new Color(0,0,1, 0.2f)));
|
||||
g2.fillRect(0, 0, 1280, 1024);
|
||||
g2.setPaint(new GradientPaint(0, 0, new Color(1,1,0, 0.6f),1280,1024 ,new Color(0,0,1, 0.2f)));
|
||||
@@ -215,8 +224,28 @@ public class MenuState extends GameState {
|
||||
|
||||
g2.setColor(Color.BLACK);
|
||||
g2.drawString("Main Menu", 32, 60);
|
||||
|
||||
g2.setFont(textFontSmall);
|
||||
|
||||
//select
|
||||
g2.setColor(GameModel.colors[0]);
|
||||
g2.fillOval(20, 900, 30, 30);
|
||||
g2.drawString("Play", 55, 920);
|
||||
|
||||
//letters
|
||||
g2.setColor(GameModel.colors[1]);
|
||||
g2.fillOval(20, 940, 30, 30);
|
||||
g2.drawString("A-Z", 55, 960);
|
||||
|
||||
//most played
|
||||
g2.setColor(GameModel.colors[4]);
|
||||
g2.fillOval(20, 980, 30, 30);
|
||||
g2.drawString("Most Played", 55, 1000);
|
||||
g2.dispose();
|
||||
|
||||
mainScreenBackground.createGraphics();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void generateSubScreenBackground(){
|
||||
@@ -247,7 +276,7 @@ public class MenuState extends GameState {
|
||||
g2.setComposite(AlphaComposite.SrcOver);
|
||||
g2.setRenderingHints(rh);
|
||||
g2.setColor(Color.BLACK);
|
||||
g2.setFont(textFont2);
|
||||
g2.setFont(textFont);
|
||||
g2.drawString(selectedToSong(selected).getTitle(), 30, 60);
|
||||
|
||||
|
||||
@@ -259,6 +288,39 @@ public class MenuState extends GameState {
|
||||
for(DifficultyButton b : buttons2){
|
||||
b.draw(g2);
|
||||
}
|
||||
|
||||
g2.setFont(textFontSmall);
|
||||
|
||||
//play song
|
||||
g2.setColor(GameModel.colors[0]);
|
||||
g2.fillOval(20, 860, 30, 30);
|
||||
g2.drawString("Play", 55, 880);
|
||||
|
||||
//back
|
||||
g2.setColor(GameModel.colors[2]);
|
||||
g2.fillOval(20, 900, 30, 30);
|
||||
g2.drawString("Back", 55, 920);
|
||||
|
||||
//up
|
||||
g2.setColor(Color.BLACK);
|
||||
Polygon p = new Polygon();
|
||||
p.addPoint(35, 940);
|
||||
p.addPoint(20, 960);
|
||||
p.addPoint(50, 960);
|
||||
g2.fillPolygon(p);
|
||||
g2.drawString("Up", 55, 960);
|
||||
|
||||
//down
|
||||
Polygon p2 = new Polygon();
|
||||
p2.addPoint(35, 1000);
|
||||
p2.addPoint(20, 980);
|
||||
p2.addPoint(50, 980);
|
||||
g2.fillPolygon(p2);
|
||||
|
||||
g2.drawString("Down", 55, 1000);
|
||||
|
||||
|
||||
|
||||
g2.dispose();
|
||||
subScreenForeground.createGraphics();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ public class PlayState extends GameState {
|
||||
public static int currentScore = 0;
|
||||
public static int comboScore = 0;
|
||||
public static double lifePoints = 100;
|
||||
|
||||
private boolean init = false;
|
||||
|
||||
private long oldProgress = 0;
|
||||
|
||||
@@ -47,7 +49,7 @@ public class PlayState extends GameState {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
init = true;
|
||||
lifePoints = 100;
|
||||
currentScore = 0;
|
||||
comboScore = 0;
|
||||
@@ -57,14 +59,6 @@ public class PlayState extends GameState {
|
||||
{
|
||||
p.getEnemysInPath().clear();
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
sh.play();
|
||||
|
||||
for (int i = 1; i < ButtonHandler.getButtons().size(); i++) {
|
||||
Button b = ButtonHandler.getButton(i);
|
||||
@@ -72,12 +66,16 @@ public class PlayState extends GameState {
|
||||
}
|
||||
|
||||
ButtonHandler.getButton(1).setColor(sh.getCurrentSongInstance().getButtons().get(0).getColor());
|
||||
|
||||
|
||||
sh.play();
|
||||
init = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(float factor) {
|
||||
|
||||
if(init)
|
||||
return;
|
||||
|
||||
long progress = (long) ((sh.getProgress() / 1000) + (Enemy.secondsToEnd * 1000));
|
||||
|
||||
for (ButtonInstance bu : sh.getCurrentSongInstance().getButtonsBetween(oldProgress, progress)) {
|
||||
@@ -90,9 +88,12 @@ public class PlayState extends GameState {
|
||||
p.addEnemy(ob.getColor(), ob.getDirection(), (int) ob.getLength());
|
||||
}
|
||||
|
||||
|
||||
if(progress > sh.getCurrentSongInstance().getEndTime() + Enemy.secondsToEnd*1000*2)
|
||||
gsm.setState(State.GAMEOVER_STATE);
|
||||
|
||||
// System.out.println(progress - oldProgress + " / " + area.paths.get(player.getIndex()).getEnemysInPath().size());
|
||||
|
||||
oldProgress = progress;
|
||||
|
||||
Enemy closedEnemy = null;
|
||||
|
||||
Reference in New Issue
Block a user