java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed.
at greenfoot.Actor.failIfNotInWorld(Actor.java:713)
at greenfoot.Actor.isTouching(Actor.java:978)
at Bullet.IfTouching(Bullet.java:32)
at Bullet.act(Bullet.java:17)
at greenfoot.core.Simulation.actActor(Simulation.java:567)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:530)
at greenfoot.core.Simulation.runContent(Simulation.java:193)
at greenfoot.core.Simulation.run(Simulation.java:183)
I have no idea why it decides it wants to do this it hasn't before
public class Bullet extends Actor
{
/**
* Act - do whatever the Bullet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
IfTouching();
move(5);
}
public void IfTouching()
{
if (isTouching(Brick.class))
{
getWorld().removeObject(this);
Greenfoot.playSound("Hit.wav");
}
if (isAtEdge())
{
getWorld().removeObject(this);
Greenfoot.playSound("Hit.wav");
}
if (isTouching(RobotEnemy.class))
{
removeTouching(RobotEnemy.class);
}
}
}

