How would I get an integer from one world and use it in another?
myWorld m = new myWorld();
score = m.getScore();// in the myWorld class
public int getScore()
{
return score;
}int score = ((myWorld)getWorld()).getScore(); // get score from world HighScoresPage hsp = new HighScoresPage(); // create high score world hsp.methodName(score); // call that method in 'hsp' that saves the score Greenfoot.setWorld(hsp); // make 'hsp' the active world
private void test()
{
int score = ((myWorld)getWorld()).getScore(); // get score from world
HighScoresPage hsp = new HighScoresPage(); // create high score world
s = Integer.toString(score);
hsp.getScore(s); // call that method in 'hsp' that saves the score
Greenfoot.setWorld(hsp); // make 'hsp' the active world
} public void getScore(String s)
{
return s;
}public void getScore(String s)
{
return s;
}int score = ((myWorld)getWorld()).getScore(); // get score from world