public class bullet extends Mover { /** * Act - do whatever the bullet wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { exitWorld(); move(10.0); Actor bee = this.getOneIntersectingObject(bee.class); Actor plane = this.getOneIntersectingObject(airplane.class); } /** * If the bullet hits the plane, or bee it disappears along with that object * or if it hits the edge,it is removed also!! */ public void exitWorld() { Actor bee = this.getOneIntersectingObject(bee.class); Actor plane = this.getOneIntersectingObject(airplane.class); if(atWorldEdge()) { getWorld().removeObject(this); } if(bee != null) { field f = (field)getWorld(); f.countHit(50); World myWorld = getWorld(); myWorld.removeObject(bee); myWorld.removeObject(this); } if(plane != null) { field f = (field)getWorld(); World myWorld = getWorld(); myWorld.removeObject(plane); myWorld.removeObject(this); f.gameOver(); } } }

