i am developing a high score system but i am separating it into another class,, world class. the problem is i cant access the variable from another world class help me... how can i access the variable from another world class in another
play aw = new play();
private int score;
public gameOver()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(500, 400, 1);
addObject(aw, 300,280);
Greenfoot.start();
showScore();
}
public void act()
{
if (Greenfoot.mouseClicked(aw)) Greenfoot.setWorld(new startup());
}
public void adScore(int points)
{
score = score + points;
showScore();
}
private void showScore()
{
showText("Your Score:" + score, 80, 25);
} //--------------------------------------------------------------------
boolean isTurning;
private int time, timeshower, Stoper;
private int score;
public static int randomer = Greenfoot.getRandomNumber (30);
/**
* Constructor for objects of class MyWorld.
*
*/
public animationStart()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1000, 500, 1);
setPaintOrder(floor.class);
setPaintOrder(Border.class);
start();
score = 0;
showScore();
time = 0;
Stoper = 0;
isTurning = false;
}
private void showScore()
{
showText("Score: " + score, 80, 25);
}
public void adScorer(int points)
{
score = score + points;
showScore();
} else if (isTouching(sooe.class))
{
removeTouching(sooe.class);
animationStart newsc = (animationStart)getWorld();
newsc.adScorer(10);
}else if (isTouching(sooe.class))
{
removeTouching(sooe.class);
animationStart newsc = (animationStart)getWorld();
newsc.adScorer(10);
gameOver scor = ( gameOver)getWorld();
scor.adScorer(10);
}public static int score;
if (score > gameOver.score) gameOver.score = score;
gameOver.score = Math.max(score, gameOver.score);