this is my code for the world and scoreboard (class name = score), i have no syntax errors but the text is not appearing. what am i doing wrong?
SPACE:
SCORE:
public class Space extends World
{
private Player1 P1;
Score scoreCounter = new Score("Score: ");
/**
* Constructor for objects of class Space.
*
*/
public Space()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1000, 500, 1);
Player1 P1 = new Player1();
addObject(P1, 350, 350);
addObject(scoreCounter, 950, 490);
addRocks();
}import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Font;
/**
* Write a description of class Score here.
*
* @author Juwan
* @version P.Bravo(2)
*/
public class Score extends Actor
{
private static final Color textColor = new Color(225, 180, 150);
public int vos = 0;
private String text;
private int stringLength;
GreenfootImage image = getImage();
Space space = (Space) getWorld();
Font font = image.getFont();
public Score()
{
this("");
}
public Score(String prefix)
{
text = prefix;
stringLength = (text.length() + 2) * 10;
setImage(new GreenfootImage(stringLength, 24));
image.setFont(font.deriveFont(24.0F));
image.setColor(textColor);
updateImage();
}
/**
* Act - do whatever the Score wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
vos++;
updateImage();
}
public int getVOS()
{
return vos;
}
public void updateImage()
{
image.clear();
image.drawString(text + vos, 1, 12);
}
}

