I am attempting to create a score board, which counts how many orbs my Penguin has eaten. I currently have an error: cannot find symbol - variable Score
My current script goes as follows:
import greenfoot.*;
import java.awt.*;
import java.awt.Color;
/**
* Write a description of class Score here.
*
* @author Connor Feltham
* @version (a version number or a date)
*/
public class Score extends Actor
{
private int Score;
/**
* Act - count the number of worms eaten. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
score();
}
public void score()
{
GreenfootImage img = new GreenfootImage(200, 200);
img.setColor (new Color(0,0,0));
float fontSize = 35.0f; //change this to the font size that you want
Font font = img.getFont();
font = font.deriveFont(fontSize);
img.setFont(font);
PenguinWorld w = (PenguinWorld) getWorld();
Penguin p = (Penguin) w.getObjects(Penguin.class).get(0);
img.drawString("Score" + p.Score, 50, 50); //this x and y position is the bottom-left of the first letter.
setImage(img);
}
}
Thanks.

