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() { setImage(new GreenfootImage("Score : " + score, 24, Color.GREEN, Color.BLACK)); //World myWorld = getWorld(); //Space space = (Space)myWorld; //Actor cherries = getOneIntersectingObject(Cherries.class); //if (cherries != null) //{ //addScore(); //} } public void addScore() { score++; } }