This site requires JavaScript, please enable it in your browser!
Greenfoot back
kiarocks
kiarocks wrote ...

2011/10/26

IllegalStateException problem

kiarocks kiarocks

2011/10/26

#
I have this code
public void act()
{
    if(getX() == 600 || getX() == 0)
     {

     }
}
and when it runs i get this exception 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:656) at greenfoot.Actor.getX(Actor.java:157) at SimpleTarget.act(SimpleTarget.java:93) at greenfoot.core.Simulation.actActor(Simulation.java:507) at greenfoot.core.Simulation.runOneLoop(Simulation.java:470) at greenfoot.core.Simulation.runContent(Simulation.java:204) at greenfoot.core.Simulation.run(Simulation.java:194) What is wrong?
kiarocks kiarocks

2011/10/26

#
Nvm, i had
if(getY() == 0)
getWorld.removeObject(this)
before it
danpost danpost

2011/10/26

#
nvm
kiarocks kiarocks

2011/10/26

#
lol
kiarocks kiarocks

2011/10/26

#
check out the new sling shot version.
You need to login to post a reply.