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

2019/10/29

Checking if the object is still there

Erik27 Erik27

2019/10/29

#
Hi I've a class in my game called Drone. If a drone hits an object of class fireball, both disappear. Everytime a drone disappears there should spawn a new one. But how can I check in the World class if an object is still there or not?
Nosson1459 Nosson1459

2019/10/29

#
it would probably just be easier to add the new drone in the previous drone like this
if(isTouching(Fireball.class))
{
    removeTouching(Fireball.class);
    getWorld.addObject(new Drone(),x,y);
    getWorld.removeObject(this);
}
You need to login to post a reply.