how will i show high score of the user using userinfo
// in MyWorld
private static int sessionHigh;
int score;
public void act()
{
if (getObjects(Player.class).isEmpty())
{
int high = sessionHigh;
String text = "FINAL SCORE";
if (UserInfo.isStorageAvailable())
{
UserInfo myInfo = UserInfo.getMyInfo();
high = myInfo.getScore();
if (sessionHigh > high)
{
myInfo.setScore(sessionHigh);
myInfo.store();
}
if (score > high)
{
myInfo.setScore(score);
myInfo.store();
high = score;
text = "NEW HIGH SCORE";
}
}
else if (score > high)
{
high = sessionHigh = score;
text = "SESSION HIGH SCORE";
}
Greenfoot.setWorld(new GameOver(score, high, text));
}
}