So I made a little 3 rank high score system out of pure messines and that is working correctly for the most part. The part that I cannot figure out is how in the heck to get input from the android user.
Here is my full code sorry for the mess (It’s 4:26 am) and I’ve been working on trying to fix this for the past few hours.
Ignore most of the dang nab nonsense, especially if its nonsense. It’s just me trying to figure out how in the heck to get text input.
EDIT: Removed curse words, sorry im tired.
if(!gameProcessor.player.isAlive()){
if(gameProcessor.asteroidsDestroyed > HighScore1){
HighScore3 = HighScore2;
scorePreferences.putInteger("score3", HighScore3);
HighScore2 = HighScore1;
scorePreferences.putInteger("score2", HighScore2);
HighScore1 = gameProcessor.asteroidsDestroyed;
scorePreferences.putInteger("score1", HighScore1);
MyTextListener listener = new MyTextListener();
Gdx.input.getTextInput(listener , "New High Score!", "Input your name", "Your name");
HighScoreName1 = listener.input;
scorePreferences.flush();
loopMusic.stop();
gameCore.setScreen(this);
}
}
else if(gameProcessor.asteroidsDestroyed > HighScore2){
HighScore3 = HighScore2;
scorePreferences.putInteger("score3", HighScore3);
HighScore2 = gameProcessor.asteroidsDestroyed;
scorePreferences.putInteger("score2", HighScore2);
MyTextListener listener = new MyTextListener();
HighScoreName2 = null;
Gdx.input.getTextInput(listener, "New High Score!", "Input your name", "Your name");
HighScoreName2 = listener.returnText();
scorePreferences.putString("name2", HighScoreName2);
loopMusic.stop();
scorePreferences.flush();
gameCore.setScreen(this);
}
}
else if(gameProcessor.asteroidsDestroyed > HighScore3){
HighScore3 = gameProcessor.asteroidsDestroyed;
scorePreferences.putInteger("score3", HighScore3);
MyTextListener listener = new MyTextListener();
Gdx.input.getTextInput(listener, "New High Score!", "Input your name", "Your name");
HighScoreName3 = listener.returnText();
HighScoreName3 = null;
scorePreferences.putString("name3", HighScoreName3);
loopMusic.stop();
if(listener.hasInputed = true){
scorePreferences.flush();
gameCore.setScreen(this);
}
}
else{
loopMusic.stop();
gameCore.setScreen(this);
}
}
}