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

2019/4/22

pls help with error.

Night Night

2019/4/22

#
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. How do I stop this error from happening, i'm trying to make one actor "eat" the other. When the prey is "eaten" this error stops the entire game. is there a way to prevent this?
Super_Hippo Super_Hippo

2019/4/22

#
Don't use methods which require the actor to be in the world after it has been removed. So move the removing of the object to the end of the act method or leave the act method if the actor isn't in a world anymore.
Night Night

2019/4/23

#
thank you :D.
You need to login to post a reply.