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

2011/12/3

Remove object code

chelle526 chelle526

2011/12/3

#
code to remove an object if it is found
kiarocks kiarocks

2011/12/3

#
if(foundObject())
    {
         getWorld().removeObject(objFound);
    }
mjrb4 mjrb4

2011/12/3

#
Your question is very vague (to the point of not being a question at all in fact!) Removing actors from the world is done via the removeObject() method, so that's what you'll need to use. If you want any more specific information though you'll have to give more information!
kiarocks wrote...
if(foundObject())
    {
         getWorld.removeObject(objFound);
    }
Please, please start testing code before you throw random snippets up, it seems to me that almost all of your code lately has been wrong in some way or other! The above for instance wouldn't even compile since you're forgetting the brackets after getWorld().
kiarocks kiarocks

2011/12/3

#
Actually, that is a mistake I make whenever I type getWorld(). I need to double check code.*facepalm*
You need to login to post a reply.