So I've tried to find this before, but had no luck
I'm trying to carry the score from my first world, to my second, and then from my second world to my third, then from the third to the endscreen
And at the moment I have the basic Score type code:
(Score class)
(Grass world class):
Any help would be appreciated
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
public class Score extends Actor
{
int score = 0;
final Color TRANSPARENT = new Color(0, 0, 0, 0);
public void act()
{
setImage(new GreenfootImage("Score : " + score, 24, Color.RED, TRANSPARENT));
}
public void addScore(int amount)
{
score = score + amount;
}
}
public class Desert extends World
{
Score score = new Score();
}
public Score getScore()
{
return score;
}

