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

2014/2/5

Removing an image

Matt Matt

2014/2/5

#
I need to remove an image from the world I have a class Bungalow Cat Door I tried getWorld().removeObject(Bugalow.Cat); I need to remove the Cat from the bungalow but the code must be in the door class
Gevater_Tod4711 Gevater_Tod4711

2014/2/5

#
I think Bungalow is your world class right? If so you can use this code to remove all Cat objects from the world:
1
getWorld().removeObjects(getWorld().getObjects(Cat.class));
If you need to remove a specific cat and ceep the other cats in the world that would be more difficult. Then you need to know which cat you want to remove from the world.
You need to login to post a reply.