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:711)
at greenfoot.Actor.isTouching(Actor.java:972)
at Zombie.stop(Zombie.java:31)
at FatZombie.act(FatZombie.java:48)
So if i shoot and kill one zombie i get this error
My Zombie class in the act method
and my collision detection method
Pls help me
thx
public void stop() { if (isTouching(Wall.class)) { speed =0; setLocation(getX()-1,getY()); } else { speed=speed; } }
public void hitnb() { if (delay <1) { if(isTouching(NBullet.class)) { removeTouching(NBullet.class); health = health -1; delay = 4; } } delay--; } public void dead() { if (health < 1) { getWorld().removeObject(this); } }