import java.awt.*; import java.util.Vector; public class Bullet extends Icobj { final static double lost = 0.01; // each transfer consumes energy final static int cohesion = 2; // influence area double energy; public Bullet(String n,int x, int y,int r,double e){ super(n,x,y); color = Color.green; radius = r; energy = e; } public String toString(){ return name; } public void moveRight(){ if(xlost) receiver.energy+=(e-lost); giver.energy-=e; } protected void giveEnergy(){ Vector icobjs = workspace.icobjsInInfluence(this,cohesion); int num = 0; for(int i=0;i