Hello everyone ,
I'm trying to get my score in the game's end to be saved , but without using the userInfo, only when stop the game without reset , as this would make the score back to zero, but it is always to zero without being saved.
In my world , I have this:
To get my highScore and insert it in the start menu, i have this:
And to save my score at the end of the game, I call for saveScore method in the snake.
Someone can help me?
public void saveScore()
{
ScoreCounter score = getScore();
if (score.getPreviousScore() > highScore)
{
highScore = score.getPreviousScore();
}
}
public int highScore()
{
return highScore;
}public void bestScore()
{
SnakeWorld world = (SnakeWorld) getWorld();
int score = world.highScore();
if(highScores[0] <= score)
{
highScores[0] = score;
}
else
{
if(highScores[1] <= score)
{
highScores[1] = score;
}
else
{
if(highScores[2] <= score)
{
highScores[2] = score;
}
}
}
}
