I put those lines in act method but "score.getValue()" says cannot find symbol-method getValue
public class CatchWorld extends SimulationWorld
{
/* (World, Actor, GreenfootImage, Greenfoot and MouseInfo)*/
protected GreenfootSound music;
protected double timeGameStart = System.currentTimeMillis();
public static double currentGameTime;
/**
*
*/
public CatchWorld()
{
super("", 800, 600, new Point2D(0.0, 0.0), 20);
music = new GreenfootSound("gamePlay.wav");
setMusic(music);
GreenfootImage background = getBackground();
background.setColor(Color.BLACK);
background.fill();
prepare();
}
/**
*
*/
public void act()
{
super.act();
List<Bowl> bowls = getObjects(Bowl.class);
if (bowls.size() > 0) {
Bowl player = bowls.get(0);
cameraCenter.setY(player.getPosition().getY() + 6.0);
}
currentGameTime = (System.currentTimeMillis() - timeGameStart) / 1000;
if (System.currentTimeMillis() >= timeGameStart + 50000) {
transitionToWorld( new EndScreenWorld(0));
}
Score score = new Score();
double scoreValue = score.getValue();
}
/**
*
*/
private void prepare()
{
Bowl bowl = new Bowl();
addObject(bowl, 400, 500);
bowl.setLocation(400, 540);
/* Generate apples for 20 screens*/
int i = 0;
while (i < 12000) {
int xPos = 40 + 60 * Greenfoot.getRandomNumber(10);
/* get random number 1 or 2 for adding apples (appleCategory 1 for Green Apple, appleCategory 2 for Yellow Apple)*/
int appleCategory = Greenfoot.getRandomNumber(2) + 1;
addObject( new Apple(appleCategory), xPos, - i);
i = i + 60;
}
Score score = new Score();
addObject(score, 700, 56);
//double scoreValue = ((Score)getObjects(Score.class).get(0)).getValue();
}
}
