"counter.add(1);" refuses to work in my program and I have no idea why. please help
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class EvilWombat here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class BlueCube extends Actor
{
/**
* Act - do whatever the EvilWombat wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(-9);
checkKill();
if(getX() < 10)
{
counter.add(1);
}
Remove();
}
private Counter counter;
public BlueCube (Counter pointCounter)
{
counter = pointCounter;
}
public void checkKill()
{
if(canSee(Soldier1.class))
{
eat(Soldier1.class);
Greenfoot.stop();
}
}
public boolean canSee(Class clss)
{
Actor actor = getOneObjectAtOffset(0, 0, clss);
return actor != null;
}
public void eat(Class clss)
{
Actor actor = getOneObjectAtOffset(0, 0, clss);
if(actor != null) {
getWorld().removeObject(actor);
}
}
public void Remove()
{
if(getX() < 10)
{
getWorld().removeObject(this);
}
}
}

