Actor bulletright=getOneIntersectingObject(bulletright.class);
if(bulletright!=null)
{
World DungeonRoom=getWorld();
DungeonRoom.removeObject(this);
Greenfoot.playSound("supermarioghosts.mp3");
}
Actor bulletleft=getOneIntersectingObject(bulletleft.class);
if(bulletleft!=null)
{
World DungeonRoom=getWorld();
DungeonRoom.removeObject(this);
Greenfoot.playSound("supermarioghosts.mp3");
}
Actor bulletup=getOneIntersectingObject(bulletup.class);
if(bulletup!=null)
{
World DungeonRoom=getWorld();
DungeonRoom.removeObject(this);
Greenfoot.playSound("supermarioghosts.mp3");
}
Actor bulletdown=getOneIntersectingObject(bulletdown.class);
if(bulletdown!=null)
{
World DungeonRoom=getWorld();
DungeonRoom.removeObject(this);
Greenfoot.playSound("supermarioghosts.mp3");
}
Basically every time i run the game i shoot the ghost its all normal then once the ghost disappears and the game stops running the terminal shows up and it says this
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.getOneIntersectingObject(Actor.java:958)
at Ghost.act(Ghost.java:37)
at greenfoot.core.Simulation.actActor(Simulation.java:604)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:562)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
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.getOneIntersectingObject(Actor.java:958)
at Ghost.act(Ghost.java:37)
at greenfoot.core.Simulation.actActor(Simulation.java:604)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:562)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
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.getOneIntersectingObject(Actor.java:958)
at Ghost.act(Ghost.java:35)
at greenfoot.core.Simulation.actActor(Simulation.java:604)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:562)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
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.getOneIntersectingObject(Actor.java:958)
at Ghost.act(Ghost.java:35)
at greenfoot.core.Simulation.actActor(Simulation.java:604)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:562)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
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.getOneIntersectingObject(Actor.java:958)
at Ghost.act(Ghost.java:35)
at greenfoot.core.Simulation.actActor(Simulation.java:604)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:562)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
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.getOneIntersectingObject(Actor.java:958)
at Ghost.act(Ghost.java:42)
at greenfoot.core.Simulation.actActor(Simulation.java:604)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:562)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
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.getOneIntersectingObject(Actor.java:958)
at Ghost.act(Ghost.java:42)
at greenfoot.core.Simulation.actActor(Simulation.java:604)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:562)
at greenfoot.core.Simulation.runContent(Simulation.java:221)
at greenfoot.core.Simulation.run(Simulation.java:211)
i dont have a clue what is wrong? so any help would be very much appreciated!

