Hi there, I really need help understanding what these lines of code say. Would really appreciate if anyone could help me out. Thak you!
*/
public class Counter extends Actor
{
private static final Color textColor = new Color(255, 180, 150);
public int target = 0;
private int stringLength;
private String text;
public Counter()
{
this("");
}
public Counter(String prefix)
{
text = prefix;
stringLength = (text.length() + 2) * 10;
setImage(new GreenfootImage(stringLength, 16));
GreenfootImage image = getImage();
image.setColor(Color.BLACK);
updateImage();
}
public void act()
{
updateImage();
}
public void add(int score)
{
target += score;
}
private void updateImage()
{
GreenfootImage image = getImage();
image.clear();
image.drawString(text + target, 1, 12);
}
}
