diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..5008ddfcf Binary files /dev/null and b/.DS_Store differ diff --git a/Asteroid.pde b/Asteroid.pde new file mode 100644 index 000000000..874fbac0e --- /dev/null +++ b/Asteroid.pde @@ -0,0 +1,84 @@ +public class Asteroid extends Floater +{ + int topSide=(int)(Math.random()*2+1); + int leftRight=(int)(Math.random()*2+1); + int topDown=(int)(Math.random()*2+1); + int dir=(int)random(0,2); + double ray; + float rand=random(1,5); + public Asteroid() + { + //xCorners=new int[]{-1,-2,-2,-6,-6,-14,-14,-15,-15,-16,-16,-17,-17,-16,-16,-15,-15,-14,-14,-5,-5,-3,-3,-2,-2,2,2,3,3,5,5,14,14,15,15,16,16,17,17,16,16,15,15,14,14,6,6,2,2,1}; + //yCorners=new int[]{20,1,2,2,1,1,2,2,15,15,2,2,-10,-10,-11,-11,-10,-10,-9,-11,-16,-16,-10,-9,-11,-11,-9,-10,-16,-16,-11,-9,-10,-10,-11,-11,-10,-10,2,2,15,15,2,2,1,1,2,2,1,20}; + yCorners=new int[]{-10,-9,-9,-5,-4,-4,-3,-3,-1,1,3,3,4,4,5,9,9,10,10,9,9,5,4,3,1,-1,-3,-4,-5,-9,-9,-10}; + xCorners=new int[]{8,8,1,1,3,7,7,4,5,5,4,7,7,3,1,1,8,8,-8,-8,-1,-1,-3,-4,-5,-5,-4,-3,-1,-1,-8,-8}; + corners=Math.min(xCorners.length, yCorners.length); + myColor=color(255,255,255); + if(topSide==0) + { + myCenterX=(int)(Math.random()*990+5); + myCenterY=0; + } + myCenterY=(int)(Math.random()*990+5); + // myDirectionX=(int)(Math.random()*5+1); + // myDirectionY=(int)(Math.random()*5+1); + if(dir==0) + { + myPointDirection=random(5,85); + }else if(dir==1) + { + myPointDirection=random(275,355); + } + ray=(myPointDirection*(Math.PI/180)); + myDirectionX=(rand)*Math.cos(ray); + myDirectionY=(rand)*Math.sin(ray); + } + public void setX(int x){myCenterX=x;} + public int getX(){return (int)myCenterX;} + public void setY(int y){myCenterY=y;} + public int getY(){return (int)myCenterY;} + public void setDirectionX(double x){myDirectionX=x;} + public double getDirectionX(){return myDirectionX;} + public void setDirectionY(double y){myDirectionY=y;} + public double getDirectionY(){return myDirectionY;} + public void setPointDirection(int degrees){myPointDirection=degrees;} + public double getPointDirection(){return myPointDirection;} + public void move() + { + super.move(); + } + public void appear() + { + if(topSide==1) + { + myCenterX=(int)(Math.random()*990+5); + if(topDown==1) + { + myCenterY=0; + }else if(topDown==2) + { + myCenterY=1000; + } + }else if(topSide==2) + { + if(leftRight==1) + { + myCenterX=0; + }else if(leftRight==2) + { + myCenterX=1000; + } + myCenterY=(int)(Math.random()*990+5); + } + } + public boolean cloDet(int box, int boy) + { + //ALERT! You can use operator overiding for this and bomDet() + return dist(box, boy, (float)myCenterX, (float)myCenterY)<=20; + } + public boolean bomDet(int box, int boy, int sphe) + { + //if(dist(box, boy, this.getX(), this.getY())>sphe+5||dist(box, boy, this.getX(), this.getY()) bolt=new ArrayList(); +ArrayList tStopX=new ArrayList(); +ArrayList tStopY = new ArrayList(); +ArrayList tieBlastX=new ArrayList(); +ArrayList tieBlastY=new ArrayList(); +ArrayList destroyID=new ArrayList(); +boolean[] guessCheck={false, false, false, false}; +Star[] stars=new Star[500]; +ArrayList rockBottom=new ArrayList(); +ArrayList missTrailX=new ArrayList(); +ArrayList missTrailY=new ArrayList(); +// ArrayList boxTars=new ArrayList(); +public String[] correctCode={"1","9","7","9"}; +public String[] guessCode={"f", "f", "f","f"}; +PImage[] endBoom=new PImage[9]; +PImage[] dio=new PImage[25]; public void setup() { - //your code here + ship=new Spaceship(); + lWing=new Colorant(new int[]{-18,-4,0,16,20,8,6,4,-4,-6,-14}, new int[]{-5,-5,-4,-4,-6,-10,-10,-6,-6,-7,-7}, color(255,0,0)); + rWing=new Colorant(new int[]{-18,-4,0,16,20,8,6,4,-4,-6,-14}, new int[]{5,5,4,4,6,10,10,6,6,7,7}, color(255, 0, 0)); + lbWing=new Colorant(new int[]{0,-3,-11,-14,-12,-2}, new int[]{-16,-12,-12,-16,-18,-18}, color(255, 0, 0)); + rbWing=new Colorant(new int[]{0,-3,-11,-14,-12,-2}, new int[]{16,12,12,16,18,18}, color(255, 0, 0)); + miss=new Missile(); + size(1000, 1000); + frameRate(60); + background(0,0,0); + noStroke(); + img=loadImage("flashtele.png"); + for(int boom=1; boom<=endBoom.length; boom++) + { + endBoom[boom-1]=loadImage("explofr"+boom+".gif"); + } + for(int worldWide=1; worldWide<=dio.length; worldWide++) + { + dio[worldWide-1]=loadImage("zawarudo"+worldWide+".gif"); + println("zawarudo"+worldWide+".gif"); + } + misstar=loadImage("missTar.png"); + tieBoom=loadImage("explosion.png"); + boomwait=loadImage("boomwait.png"); + telewait=loadImage("telewait.png"); + timewait=loadImage("timewait.png"); + spinwait=loadImage("spinwait.png"); + boxTar=loadImage("boxTarget.png"); + misswait=loadImage("misswait.png"); + xOut=loadImage("tempOut.png"); + for(int i=0; i=900) + { + if(fireHome==false) + { + boom=true; + missOff=true; + ship.setBombX(ship.getX()); + ship.setBombY(ship.getY()); + blastWait=0; + retMiss(); + selectTar=false; + fireHome=false; + missSet=false; + missTrailX.clear(); + missTrailY.clear(); + } + } + break; + case 'g': + if(missOff==false) + { + if(missWait>=300) + { + home=!home; + if(home==false) + { + retMiss(); + selectTar=false; + fireHome=false; + missSet=false; + missTrailClear(); + } + if(home) + { + if(fireHome!=true) + { + selectTar=true; + missTrailClear(); + } + } + } + } + break; + case 'v': + invinc=true; + break; + case 'r': + if(cheat) + { + endX=ship.getX(); + endY=ship.getY(); + stopShip(); + endGame=true; + } + break; + case 'b': + if(cheat) + { + if(invfill<100) + { + invfill+=25; + } + } + break; + case 'n': + if(cheat) + { + if(invfill>0) + { + invfill=0; + } + } + break; + case 'h': + if(cheat) + { + if(missOff==false) + { + if(missWait>=300) + { + home=!home; + if(home==false) + { + retMiss(); + selectTar=false; + fireHome=false; + missSet=false; + missTrailClear(); + } + if(home) + { + if(fireHome!=true) + { + selectTar=true; + missBounce=true; + missTrailClear(); + } + } + } + } + } + break; + case 't': + if(cheat) + { + for(int h=0; h<20; h++) + { + rockBottom.add(new Asteroid()); + if(rockBottom.get(rockBottom.size()-1).getDirectionX()==0) + { + if(rockBottom.get(rockBottom.size()-1).getDirectionY()==0) + { + bolAstX=rockBottom.get(rockBottom.size()-1).getX(); + bolAstY=rockBottom.get(rockBottom.size()-1).getY(); + image(tieBoom, bolAstX, bolAstY, 50, 50); + rockBottom.remove(rockBottom.size()-1); + } + } + if(rockBottom.get(rockBottom.size()-1).cloDet(ship.getX(), ship.getY())) + { + rockBottom.remove(rockBottom.size()-1); + } + } + } + break; + case 'y': + if(cheat) + { + rockBottom.clear(); + selectTar=false; + fireHome=false; + missSet=false; + home=false; + retMiss(); + } + break; + case 'm': + if(cheat) + { + invTest=!invTest; + } + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '0': + if(open) + { + if(cheatCode) + { + if(pCount>=0) + { + if(guessCode.length<5) + { + for(int i=0; i=rockBottom.get(m).getX()-25&&mouseX<=rockBottom.get(m).getX()+25&&mouseY>=rockBottom.get(m).getY()-25&&mouseY<=rockBottom.get(m).getY()+25) + { + missSet=true; + missShip=m; + break; + } + } + } + } +} +void missTarCheck() +{ + if(missBounce==false) + { + if(dist(miss.getX(), miss.getY(), tarX, tarY)<10) + { + missi=true; + missCount=0; + rockBottom.remove(missShip-1); + scorCount++; + missEndX=tarX; + missEndY=tarY; + missWait=0; + selectTar=false; + fireHome=false; + missSet=false; + home=false; + retMiss(); + + } + }else if(missBounce==true) + { + if(dist(miss.getX(), miss.getY(), tarX, tarY)<40) + { + missi=true; + missCount=0; + if(rockBottom.size()==missShip) + { + missShip-=1; + } + if(rockBottom.size()>0) + { + rockBottom.remove(missShip-1); + }else if(rockBottom.size()==0) + { + rockBottom.remove(missShip); + } + scorCount++; + missEndX=tarX; + missEndY=tarY; + if(rockBottom.size()-1==0) + { + missWait=0; + selectTar=false; + fireHome=false; + missSet=false; + home=false; + missBounce=false; + retMiss(); + } + } + } +} +void missCount() +{ + if(missCount<201&&missi) + { + if(missCount/10<9) + { + image(endBoom[missCount/10], missEndX-50,missEndY-50, 100, 100); + } + if(missCount==200) + { + missi=false; + } + if(missi) + { + missCount++; + } + } +} +boolean overRect(int x, int y, int width, int height) { + if(mouseX>=x&&mouseX<=x+width&&mouseY>=y&&mouseY<=y+height) + { + return true; + }else{ + return false; + } } +boolean overCircle(int x, int y, int diameter) { + float disX = x - mouseX; + float disY = y - mouseY; + if(sqrt(sq(disX) + sq(disY)) < diameter/2) + { + return true; + }else{ + return false; + } +} +public void codeNum() +{ + for(int c=0;c<(int)(firstF())&&c1000||bolt.get(e).myCenterX<0||bolt.get(e).myCenterY>1000||bolt.get(e).myCenterY<0) + { + bolt.remove(e); + } + } +} +//removes the bolts once they go offscreen +void teleFrameCount() +{ + if(count<5&&tele) + { + flashDis(); + if(count==4) + { + tele=false; + } + } + if(tele) + { + count++; + } +} +//frame counter for teleportation image +void shipExploCounter() +{ + if(eCount<201&&endGame) + { + if(eCount/10<9) + { + image(endBoom[eCount/10], endX-150,endY-150, 300, 300); + } + if(eCount==200) + { + endGame=false; + open=true; + start=false; + bolt.clear(); + tStopClear(); + tieBlastClear(); + destroyID.clear(); + rockBottom.clear(); + varReset(); + shipReset(); + home=false; + retMiss(); + suckCount++; + } + if(endGame) + { + eCount++; + } + } +} +//ship explosion counter at the end of the game +public void helpWall() +{ + textSize(25); + fill(255,255,255); + text("ability name: description, button,",5,30); + text("time w/o invincibility, time w/ invincibility",5,60); + text("move forward/backward: up/down arrow keys",5,100); + text("turn left/right: left/right arrow keys",5,140); + text("shoot bolt: space button",5,180); + text("bomb: destroys all ships on screen, Q,", 5,220); + text("15 seconds, 3 seconds",5,250); + text("time stop: stops all ships from moving",5,300); + text("for one second, E, 10 seconds, 2 seconds",5,330); + text("set teleport tag: places the tag that the",5,380); + text("teleport move teleports to, Z, no recharge",5,410); + text("teleport: teleports the ship to the",5,460); + text("teleport tag, X, 5 seconds, 1 second",5,490); + text("spiral: makes a spiral of bullets from the",5,540); + text("ship, C, 5 seconds, 1 second",5,570); + text("invincibility: become invincible for a", 5,620); + text("V, destroy ships to recharge but length",5,650); + text("depends on counter of destroyed ships,",5,680); + text("in top right corner, lasts max of ten seconds",5,710); + text("homing missile: shoot a homing missile to",5,760); + text("destroy one target, G, 5 seconds, 1 second",5,790); + text("return to main menu: u",5, 740); + line(500,0,500,1000); + stroke(255, 255, 255); + line(860, 30, 870, 40); + line(820,40,870,40); + line(860,50,870,40); + text("invincibility counter", 580,50); + if(cheat) + { + fill(255,0,0); + text("Cheat Ability Keys:",550,150); + text("R: game over test",550,200); + text("B: fill invincibility counter by 25%",550,250); + text("N: empties the invincibility counter",550,300); + text("T: make 20 more tie fighters",550,350); + text("Y: remove all tie fighters instantly",550,400); + text("M: toggle invincibility, regardless",550,450); + text("of the invincibility counter",550,490); + text("K: makes 1 fast tie fighter",550,540); + text("H: makes it so that the homing",550,590); + text("missile destroys many targets after",550,620); + text("it destroys the initial target, though",550,650); + text("the score counter gets glitchy",550,680); + text("O: bizarre effect to time stop",550,710); + } +} +//help button code +public void boomDis() +{ + for(int z=0;z=rockBottom.size()) + { + break; + } + //destroyID.add(c); + blast=true; + if(invfill<101) + { + invfill++; + } + if(rockBottom.size()-ccount-1==c) + { + break; + } + } + if(c+ccount>=rockBottom.size()) + { + break; + } + } + //boomDis(); + } +} +//bolt to asteroid impact detection +public void boltAstCount() +{ + if(dCount<31&&blast) + { + boAst(); + image(tieBoom, bolAstX, bolAstY, 50, 50); + if(dCount==30) + { + blast=false; + dCount=0; + } + if(blast) + { + dCount++; + } + } +} +//bolt to asteroid frame counter +public void bombRingCount() +{ + if(bCount<51&&boom) + { + boomDis(); + if(bCount==50) + { + boom=false; + missOff=false; + bCount=0; + tieBlastClear(); + } + } + if(boom) + { + fill(255,255,255); + ellipse(ship.getBombX(), ship.getBombY(), bCount*50, bCount*50); + fill(0,0,0); + ellipse(ship.getBombX(), ship.getBombY(), (bCount*35), (bCount*35)); + int ccount=0; + for(int z=0;z0&&invinc) + { + invShipFlash(invfill); + } + if(invfill<=0&&endGame==false) + { + invinc=false; + invfill=0; + ship.myColor=color(211,211,211); + lWing.myColor=color(255,0,0); + rWing.myColor=color(255,0,0); + lbWing.myColor=color(255,0,0); + rbWing.myColor=color(255,0,0); + } + if(invinc) + { + invfill-=0.16; + } +} +//invincibility color counter +public void newBoltSpiral() +{ + ship.setPointDirection((int)(ship.getPointDirection()-9)); + lWing.setPointDirection((int)(lWing.getPointDirection()-9)); + rWing.setPointDirection((int)(rWing.getPointDirection()-9)); + lbWing.setPointDirection((int)(lbWing.getPointDirection()-9)); + rbWing.setPointDirection((int)(rbWing.getPointDirection()-9)); + bolt.add(new Bolt()); +} +//adds a bolt for bolt spiral +public void boltSpiral() +{ + if(sCount<41&&bolSpi) + { + if(sCount==40) + { + bolSpi=false; + sCount=0; + missOff=false; + } + if(bolSpi) + { + newBoltSpiral(); + sCount++; + } + } +} +//bolt spiral frame counter +public void newTie() +{ + if(turn%200==0&&tStop==false) + { + rockBottom.add(new Asteroid()); + if(rockBottom.get(rockBottom.size()-1).cloDet(ship.getX(), ship.getY())) + { + rockBottom.remove(rockBottom.size()-1); + } + } + turn++; +} +//adds a new asteroid every 100 frames +public void abilCount() +{ + if(invinc==false) + { + if(blastWait<900) + { + blastWait++; + } + if(chroWait<600) + { + chroWait++; + } + if(telWait<300) + { + telWait++; + } + if(spiWait<300) + { + spiWait++; + } + if(missWait<300) + { + missWait++; + } + }else if(invinc==true) + { + if(blastWait<900) + { + blastWait+=5; + } + if(chroWait<600) + { + chroWait+=5; + } + if(telWait<300) + { + telWait+=5; + } + if(spiWait<300) + { + spiWait+=5; + } + if(missWait<300) + { + missWait+=5; + } + } +} +//determines recharge time +public void helpDraw() +{ + if(help) + { + helpWall(); + } +} +public void starShow() +{ + for(int i=0; i - Title + Asteroids Game
-

Header

+

Tie Fighters vs Jedi Interceptor

- +
diff --git a/missTar.png b/missTar.png new file mode 100644 index 000000000..0505bea0f Binary files /dev/null and b/missTar.png differ diff --git a/misswait.png b/misswait.png new file mode 100644 index 000000000..edc6d97be Binary files /dev/null and b/misswait.png differ diff --git a/spinwait.png b/spinwait.png new file mode 100644 index 000000000..5a705c6f5 Binary files /dev/null and b/spinwait.png differ diff --git a/telewait.png b/telewait.png new file mode 100644 index 000000000..a38982d4c Binary files /dev/null and b/telewait.png differ diff --git a/tempOut.png b/tempOut.png new file mode 100644 index 000000000..cc9307389 Binary files /dev/null and b/tempOut.png differ diff --git a/timewait.png b/timewait.png new file mode 100644 index 000000000..deb301b82 Binary files /dev/null and b/timewait.png differ diff --git a/zaWarudoGif.gif b/zaWarudoGif.gif new file mode 100644 index 000000000..0856b84aa Binary files /dev/null and b/zaWarudoGif.gif differ diff --git a/zawarudo.jpg b/zawarudo.jpg new file mode 100644 index 000000000..2c8d8dbad Binary files /dev/null and b/zawarudo.jpg differ diff --git a/zawarudo1.gif b/zawarudo1.gif new file mode 100644 index 000000000..f79aa2d62 Binary files /dev/null and b/zawarudo1.gif differ diff --git a/zawarudo10.gif b/zawarudo10.gif new file mode 100644 index 000000000..002cf7e26 Binary files /dev/null and b/zawarudo10.gif differ diff --git a/zawarudo11.gif b/zawarudo11.gif new file mode 100644 index 000000000..6dc9efe74 Binary files /dev/null and b/zawarudo11.gif differ diff --git a/zawarudo12.gif b/zawarudo12.gif new file mode 100644 index 000000000..2f8553b0e Binary files /dev/null and b/zawarudo12.gif differ diff --git a/zawarudo13.gif b/zawarudo13.gif new file mode 100644 index 000000000..85dbbe566 Binary files /dev/null and b/zawarudo13.gif differ diff --git a/zawarudo14.gif b/zawarudo14.gif new file mode 100644 index 000000000..8a193b3ee Binary files /dev/null and b/zawarudo14.gif differ diff --git a/zawarudo15.gif b/zawarudo15.gif new file mode 100644 index 000000000..15f1713ac Binary files /dev/null and b/zawarudo15.gif differ diff --git a/zawarudo16.gif b/zawarudo16.gif new file mode 100644 index 000000000..5878be130 Binary files /dev/null and b/zawarudo16.gif differ diff --git a/zawarudo17.gif b/zawarudo17.gif new file mode 100644 index 000000000..be0d24d0c Binary files /dev/null and b/zawarudo17.gif differ diff --git a/zawarudo18.gif b/zawarudo18.gif new file mode 100644 index 000000000..70be9b3cb Binary files /dev/null and b/zawarudo18.gif differ diff --git a/zawarudo19.gif b/zawarudo19.gif new file mode 100644 index 000000000..84338dca7 Binary files /dev/null and b/zawarudo19.gif differ diff --git a/zawarudo2.gif b/zawarudo2.gif new file mode 100644 index 000000000..0d5e67001 Binary files /dev/null and b/zawarudo2.gif differ diff --git a/zawarudo20.gif b/zawarudo20.gif new file mode 100644 index 000000000..7dfb8f5de Binary files /dev/null and b/zawarudo20.gif differ diff --git a/zawarudo21.gif b/zawarudo21.gif new file mode 100644 index 000000000..13d0e4dfb Binary files /dev/null and b/zawarudo21.gif differ diff --git a/zawarudo22.gif b/zawarudo22.gif new file mode 100644 index 000000000..13d0e4dfb Binary files /dev/null and b/zawarudo22.gif differ diff --git a/zawarudo23.gif b/zawarudo23.gif new file mode 100644 index 000000000..cf8ae6035 Binary files /dev/null and b/zawarudo23.gif differ diff --git a/zawarudo24.gif b/zawarudo24.gif new file mode 100644 index 000000000..4ada45b42 Binary files /dev/null and b/zawarudo24.gif differ diff --git a/zawarudo25.gif b/zawarudo25.gif new file mode 100644 index 000000000..fea4c1e28 Binary files /dev/null and b/zawarudo25.gif differ diff --git a/zawarudo3.gif b/zawarudo3.gif new file mode 100644 index 000000000..0509b1973 Binary files /dev/null and b/zawarudo3.gif differ diff --git a/zawarudo4.gif b/zawarudo4.gif new file mode 100644 index 000000000..046a34436 Binary files /dev/null and b/zawarudo4.gif differ diff --git a/zawarudo5.gif b/zawarudo5.gif new file mode 100644 index 000000000..6961ca95c Binary files /dev/null and b/zawarudo5.gif differ diff --git a/zawarudo6.gif b/zawarudo6.gif new file mode 100644 index 000000000..4779e144f Binary files /dev/null and b/zawarudo6.gif differ diff --git a/zawarudo7.gif b/zawarudo7.gif new file mode 100644 index 000000000..c607b03f3 Binary files /dev/null and b/zawarudo7.gif differ diff --git a/zawarudo8.gif b/zawarudo8.gif new file mode 100644 index 000000000..5c63f7bf3 Binary files /dev/null and b/zawarudo8.gif differ diff --git a/zawarudo9.gif b/zawarudo9.gif new file mode 100644 index 000000000..607b84f74 Binary files /dev/null and b/zawarudo9.gif differ