when I try to implement the code from the access tutorial, this comes up in the terminal window.
java.lang.NullPointerException
at Bullet.addScore(Bullet.java:37)
at Bullet.act(Bullet.java:29)
at greenfoot.core.Simulation.actActor(Simulation.java:568)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:526)
at greenfoot.core.Simulation.runContent(Simulation.java:215)
at greenfoot.core.Simulation.run(Simulation.java:205)
here is the code in the world:
here is the code in the bullet:
move(50);
Actor enemy;
enemy = getOneObjectAtOffset(0, 0, Enemy.class);
if (enemy != null)
{
World world;
world = getWorld();
world.removeObject(enemy);
Deadenemy deadenemy = new Deadenemy();
getWorld().addObject(deadenemy, getX(), getY());
addScore();
getWorld().removeObject(this);
}
public void addScore()
{
Space spaceWorld = (Space) getWorld();
Counter counter = spaceWorld.getCounter();
counter.bumpCount(5);
}
private Counter theCounter;
public Counter getCounter()
{
return theCounter;
}


