Hello all..
I have a problem when playing this game, when just a few moments play the game directly out such notification
Notice
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 Laser.act(Laser.java:34)
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)
import greenfoot.*;
[code]import greenfoot.*;
public class Laser extends Actor
{
private boolean toRemove=false;
private int vx=3;
public void addedToWorld(World Latar)
{
GreenfootImage image=new GreenfootImage(50,10);
image.setColor(Color.RED);
image.drawLine(0,5,image.getWidth()-1,5);
setImage(image);
}
public void act()
{
if(!toRemove){
setLocation(getX()+vx,getY());
Actor actor=getOneIntersectingObject(Alien.class);
if(actor!=null){
World myWorld = getWorld();
((Alien)actor).Hancur();
Latar latar = (Latar)myWorld;
Counter counter = latar.getCounter();
counter.addScore();
}
if(getX()>getWorld().getWidth()+200)toRemove=true;
}else{
World myWorld = getWorld();
getWorld().removeObject(this);
}
(isTouching(Alien.class))
{
getWorld().removeObject(this);
}
}
}

