Hi! I'm creating a game and I need help making a current score and high score which I need to use in two different worlds.
public class Counter1 extends Actor
{
/**
* Act - do whatever the Counter wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int score = 0;
public Counter1()
{
setImage(new GreenfootImage("Score: " + score, 50, Color.WHITE, Color.BLACK));
}
public void act()
{
setImage(new GreenfootImage("Score: " + score, 50, Color.WHITE, Color.BLACK));
}
public void addScore(int scoreUp)
{
score =+ score + scoreUp;
}
}