I am helping a friend with a program for school and the text doesn't get displayed on the screen for some reason.... Here is the label code and the world code
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class Label here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Label extends Actor
{
public int score;
public Label(int intialScore)//int initialScore )
{
score = intialScore;
setImage(new GreenfootImage( 200, 30 ));
changeScore();
}
public void act()
{
changeScore();
}
public void addScore()
{
score++;
changeScore();
}
public void changeScore()
{
GreenfootImage img = getImage();
img.clear();
//img.setColor( new Color( 100, 100, 100 ));
img.setColor( Color.BLACK );
//img.setFont( new Font("Comic Sans MS", Font.BOLD, 24) );
score++; // add points to current score
img.drawString( "Damage: " + score , 100, 100);
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class SpaceWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SpaceWorld extends World
{
/**
* Constructor for objects of class SpaceWorld.
*
*/
//private int DAMAGE = 0;
private Label label;
public int intialScore;
public SpaceWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
prepare();
}
/**
* Prepare the world for the start of the program. That is: create the initial
subclass * objects and add them to the world.
*/
private void prepare()
{
Label label = new Label(intialScore);
addObject(label, 100, 100);
Spaceship spaceship = new Spaceship(label);
addObject(spaceship, 234, 205);
EnergyBulllet energybullet = new EnergyBulllet();
addObject(energybullet, 134, 0);
EnergyBulllet energybullet2 = new EnergyBulllet();
addObject(energybullet2, 367, 0);
}
public void score()
{
label.addScore();
}
}

