This is the code im using to retrieve and print, but nothing is appearing. I have used both "UserInfo.getMyInfo().getScore();" and "Score" with same results. I dont think its a problem with the "drawImg" procedure as i have used it before and it has worked fine.
How could i go about saving and retrieving the top 10 scores from multiple players? this is the code i am currently using to save:
Also, is there a way to bring the Player change pop up box, without manually pressing CMD + SHIFT + P ?
Thank you
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.awt.Font;
public class getHighScores extends Actor
{
private int score;
public getHighScores()
{
setImage(new GreenfootImage(150, 60));
getScore();
}
public int getScore()
{
return UserInfo.getMyInfo().getScore();
//return Score;
}
public void drawImg()
{
score = getScore();
GreenfootImage image = new GreenfootImage(150, 60);
image.setColor(Color.WHITE); //my background is black
float fontSize = 35.0f;
Font font = image.getFont().deriveFont(fontSize);
image.setFont(font);
image.drawString("" + score, 50, image.getHeight()/2);
setImage(image);
}
}if (UserInfo.isStorageAvailable())
{
UserInfo myInfo = UserInfo.getMyInfo();
if (ScoreBoard.Score > myInfo.getScore())
{
myInfo.setScore(ScoreBoard.Score);
myInfo.store();
}
}
