Added timeout before you can send your highscore
This commit is contained in:
@@ -37,6 +37,9 @@ public class EndState extends GameState {
|
||||
private boolean uploaded;
|
||||
private BufferedImage QRimage;
|
||||
|
||||
boolean timeOut = false;
|
||||
float timeOutCounter = 0;
|
||||
|
||||
int frame;
|
||||
|
||||
public EndState(GameStateManager gsm, SongHandler sh, SQLConnector sql) {
|
||||
@@ -47,11 +50,15 @@ public class EndState extends GameState {
|
||||
@Override
|
||||
public void init() {
|
||||
createBackground();
|
||||
|
||||
ButtonHandler.getButton(1).setColor(GameModel.colors[0]);
|
||||
ButtonHandler.getButton(2).setColor(GameModel.colors[2]);
|
||||
|
||||
JoystickHandler.REPEAT = true;
|
||||
uploaded = false;
|
||||
// System.out.println("Endgame: "+PlayState.won());
|
||||
timeOut = true;
|
||||
timeOutCounter = 0;
|
||||
|
||||
if(PlayState.won()){
|
||||
end = Images.getImage(Images.ImageType.youwon);
|
||||
}else{
|
||||
@@ -61,6 +68,17 @@ public class EndState extends GameState {
|
||||
|
||||
@Override
|
||||
public void update(float factor) {
|
||||
if(timeOut)
|
||||
{
|
||||
timeOutCounter += factor;
|
||||
|
||||
if(timeOutCounter > 800)
|
||||
{
|
||||
timeOut = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
image_x = ((frame / 5) % 5) * 40;
|
||||
frame++;
|
||||
}
|
||||
@@ -84,7 +102,8 @@ public class EndState extends GameState {
|
||||
|
||||
@Override
|
||||
public void buttonPressed(ButtonEvent e) {
|
||||
//System.out.println("Name: "+hsn.getName());
|
||||
if(!timeOut)
|
||||
{
|
||||
switch(e.getButton().getButtonID()){
|
||||
case 0:
|
||||
gsm.setState(State.TITLE_STATE);
|
||||
@@ -116,15 +135,16 @@ public class EndState extends GameState {
|
||||
gsm.setState(State.MENU_STATE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonReleased(ButtonEvent e) {
|
||||
public void buttonReleased(ButtonEvent e) {}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onJoystickMoved(JoystickEvent e) {
|
||||
if(!timeOut)
|
||||
{
|
||||
switch(e.getJoystick().getPos()){
|
||||
case DOWN:
|
||||
hsn.down();
|
||||
@@ -142,6 +162,7 @@ public class EndState extends GameState {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void createBackground(){
|
||||
background = Images.initVolatileImage(1280, 1024, Transparency.OPAQUE);
|
||||
|
||||
Reference in New Issue
Block a user