//--------------------------------------------- class Beam { float originX, originY, vecX, vecY; int age, res, range, originalAge; float[] beamX, beamY, beamVX, beamVY; boolean ignore; Beam nextBeam; //next object in a linked list //--------------------------------------------- Beam(float x, float y, float vx, float vy){ ignore = false; age = 20; originalAge = 20; range = 400; res = 150; originX = x; originY = y; vecX = vx/dist(0,0,vx,vy); vecY = vy/dist(0,0,vx,vy); beamX = new float[res]; beamY = new float[res]; beamVX = new float[res]; beamVY = new float[res]; for(int i=0;i 0 then the beam points away from the enemy dotProd = vecX*(originX-enemy.x) + vecY*(originY-enemy.y); if( t < 12 && dotProd < 0) enemy.kill(); } //--------------------------------------------- void visualize(){ //Draws the shot for(int i=0;i