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

2012/5/17

getWorld().removeObject(this); // Actor not in world error

needcodehelp needcodehelp

2012/5/17

#
I am new to Greenfoot and need help getting an item to disappear when it hits the edge of the world. Right now when it gets to the edge, I get an "Actor not in world error" and don't know why. Am trying this for my "bullet" object: if ( atWorldEdge() ) { getWorld().removeObject(this); } but it is not working. Any help or ideas are appreciated!
MrDoomsday MrDoomsday

2012/5/17

#
Don't worry that is a common mistake. Be sure that there is NO other code following that one. So if there is put it BEFORE the atWorldEdge() check.
davmac davmac

2012/5/17

#
Full explanation here.
needcodehelp needcodehelp

2012/5/18

#
Thank you, will try!
You need to login to post a reply.