How do I code this:
A Bullet collides with another Object and the Object dissapears and the Bullet dissapears too so that It doesnt collete more Objects.
public void act() { if (Remove()) { getWorld().removeObject(this); } }
public boolean Remove() { Object obj= (Object)getOneIntersectingObject(Object.class); if(obj != null) { return true; getWorld().removeObject(obj); } return false; }
import greenfoot.*; public class Object extends Actor { public boolean Hit = false; public void act() { if(Hit == true) { getWorld().removeObject(this); Hit = false; } } }