class CrawCannon extends Goon{ int shotRate=10; int shields=8; boolean started=false; boolean blocking=false; ArrayList bullets=new ArrayList(); CrawCannon(Vector3D p){ pos=new Vector3D(100,height/2); vel=new Vector3D(); rad=80; } void unique(){ blocking=false; if(!started){ for(int j=0;j0){ WingMan w= h.leftWingMan; for(int t=0;t<2;t++){ Vector3D v = w.pos.copy(); v.sub(pos); if(v.magnitudeSquared2D()<6400){ v.mult(.9); w.vel.add(v); blocking=true; } w=h.rightWingMan; } } else{ super.checkCollision(); if(!alive){ for(int i=0; i< bullets.size(); i++){ LaserBall g=(LaserBall)bullets.get(i); monsters.add(g); } } } } void render(){ pushMatrix(); noStroke(); translate(pos.x,pos.y); noFill(); for(int i=0; i5){ return(checkAlongLine(p1,pm,distance/2)||checkAlongLine(pm,p2,distance/2));//recursion w00t! } return false; } void unique(){ angle=-parent.angle*2+offsetAngle; pos.x=orbitPoint.x+orbitDist*cos(angle); pos.y=orbitPoint.y+orbitDist*sin(angle); } void checkWalls(){ } void movement(){ pos.add(vel); } void render(){ pushMatrix(); noStroke(); translate(pos.x,pos.y); rotate(angle); fill(150); if(parent.blocking){ fill(200,250,250); } ellipse(0,0,rad*1.3,rad*1.3); rotate(-4*angle); fill(0,250,80); if(parent.blocking){ fill(100,255,255); } ellipse(rad/3,0,rad/4,rad/4); ellipse(-rad/3,0,rad/4,rad/4); ellipse(0,-rad/3,rad/4,rad/4); ellipse(0,rad/3,rad/4,rad/4); popMatrix(); } } class LaserBall extends Goon{ ///////////////////////////////// LaserBall ////////////////////////////////////////////////////////////// float speed=6; float spin=.01; boolean oneShot=false; ArrayList parent; LaserBall(Vector3D p){ pos= p.copy(); acc=new Vector3D(); vel=new Vector3D(speed,random(0,TWO_PI),true); rad=25; type = LASERBALL; if(random(0,1)<.5){ spin*=-1; } } LaserBall(Vector3D p,float moveAngle, float startAngle, ArrayList par){ parent=par; pos= p.copy(); acc=new Vector3D(); vel=new Vector3D(speed,moveAngle,true); angle=startAngle; rad=25; type = LASERBALL; oneShot=true; } void checkWalls(){ if(oneShot){ if(pos.x<-20||pos.x>width+20||pos.y<-20||pos.y>height+20){ parent.remove(this); monsters.remove(this); } } else{ if(pos.x<0){ vel.x=abs(vel.x); } if(pos.x>width){ vel.x=-abs(vel.x); } if(pos.y<0){ vel.y=abs(vel.y); } if(pos.y>height){ vel.y=-abs(vel.y); } } } void movement(){ vel.add(acc); pos.add(vel); angle+=spin; } void unique(){ line(pos.x+vel.x,pos.y+vel.y,pos.x-2000*sin(angle),pos.y+2000*cos(angle)); noStroke(); Vector3D ptOut = new Vector3D(pos.x-2000*sin(angle),pos.y+2000*cos(angle)); // checkAlongLine(pos,ptOut,pos.distance(pos,ptOut)); for(int i=0;i5){ checkAlongLine(p1,pm,distance/2);///recursion w00t! checkAlongLine(pm,p2,distance/2); } } void render(){ pushMatrix(); noStroke(); translate(pos.x,pos.y); rotate(angle); fill(0,250,190); ellipse(0,0,rad*1.3,rad*1.3); fill(0,250,110); beginShape(); vertex(-rad/2,0); vertex(rad/2,0); vertex(0,rad/2); endShape(); fill(200,250,250); beginShape(); vertex(-rad/4,0); vertex(0,2); vertex(rad/4,0); vertex(0,rad/2-3); endShape(); stroke(255); line(0,0,0,rad/2*1.3); noStroke(); popMatrix(); } }