Sorry what do you mean by fields in my world class and by area I am trying to access the score, do you mean the method I want to use it in?
Sorry about this and thanks for persevering.
if(score == 10)
{
addObject(new Square2, 0, 0);
}public class mainWorld extends World
{
Score score = new Score();
public mainWorld()
{
super(256, 512, 1);
setBackground("Background.png");
Greenfoot.setWorld(new mainMenu());
if(score == 10)
{
addObject(new Square2(), 0, 0);
}
displayUser();
displayDefault();
displayScore();
getScore();
}
public void displayUser()
{
User userMain = new User();
addObject(userMain, 128, 48);
}
public void displayDefault()
{
int randomXe1 = Greenfoot.getRandomNumber(256);
int randomXe2 = Greenfoot.getRandomNumber(256);
int randomXe3 = Greenfoot.getRandomNumber(256);
addObject(new Rectangle(), randomXe1, 512);
addObject(new Rectangle2(), randomXe2, 512);
addObject(new Square(), randomXe3, 512);
}
public void displayScore()
{
score = new Score();
addObject(score, 128, 505);
}
public Score getScore()
{
return score;
}
}