Is there anyway to update the score with showText? heres my code
myworld class:
Counter counter = new Counter();
public Counter getCounter()
{
return counter;
}
public void displayScore()
{
showText("Red: " + redBall, 50, 410);
score++;
showText("blue: " + blueBall, 50, 890);
score++;
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class Counter here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Counter extends Actor
{
int score = 0;
/**
* Act - do whatever the Counter wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
}
public void addScore()
{
score++;
}
}
