Ok so basically im getting the error:
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.
With the code:
I get this error whenever the bee touches the trip_wire and it says the error is in the lizard part of this code but whenever the lizard touches the trip_wire it works perfectly fine, what am I doing wrong?
public void image()
{
if (isTouching(Bee.class))
{
setImage("Explosion" + ".png");
Greenfoot.delay(5);
getWorld().removeObject(this);
}
}
public void imageswap()
{
if (isTouching(Lizard.class))
{
setImage("Explosion" + ".png");
Greenfoot.delay(5);
getWorld().removeObject(this);
}
}
