class Sperm extends Entity{ int id = 0; float turnSpeed = 0.15; float acceleration = 0.2; float defaultSpeed = 1; float tailTimer; float eatDistance = 7; float pushDistance = 40; int pulseCost = 30; int charge = 0; int score = 0; int scoreX = 0; int scoreY = 0; //------------- Sperm(int ix, int iy, int id){ super(ix,iy); this.id = id; if(id==0) setScorePos(8,25); if(id==1) setScorePos(width-10,25); tailTimer = 0; isPushable = true; } //------------- void update(){ charge++; tailTimer += mag(vx,vy)*defaultSpeed; if( mag(vx,vy) > defaultSpeed ){ float slowX = vx*friction; float slowY = vy*friction; vx -= slowX*gameSpeed; vy -= slowY*gameSpeed; } super.update(); for( int i=0 ; i1 ){ e.vx += 50*(e.x-x)/sq(d); e.vy += 50*(e.y-y)/sq(d); } } } } }