however when i add it in the world prepare method, it comes up with the error message: cannot find symbol - constructor SimpleCounter().
here is my code:
import greenfoot.*; import java.awt.Color; /** * Counter that displays a number with a text prefix. * See the ScoreBoard class. It is very similar to this, but the image includes a box with a border. * * @author Michael Kolling * @version 2.0 */ public class SimpleCounter extends Actor { private int counterValue; private String counterText; public SimpleCounter(String text) { counterText = text; counterValue = 5; int counterWidth = (counterText.length() + 2) * 10; int counterHeight = 16; GreenfootImage image = new GreenfootImage(counterWidth, counterHeight); setImage(image); updateImage(); } public void act() { } public void add(int amount) { counterValue = counterValue + amount; updateImage(); } public void subtract(int amount) { counterValue = counterValue - amount; updateImage(); } public int getValue() { return counterValue; } /** * Make the image */ private void updateImage() { GreenfootImage image = getImage(); image.clear(); image.setColor(Color.BLACK); image.drawString(counterText + counterValue, 1, 12); } }