• fullscreen
  • GameKeyboard.pde
  • Hydro0_2.pde
  • ball.pde
  • hydroplane.pde
  • missl.pde
  • mover.pde
  • import java.awt.*; 
    
    class GameKeyboard implements KeyEventDispatcher
    {
      boolean up=false;
        boolean down=false;
          boolean right=false;
            boolean left=false;
            boolean space=false;
            boolean a=false;
                    boolean s=false;
                            boolean d=false;
                                    boolean w=false;
                 boolean i=false;
                    boolean j=false;
                            boolean k=false;
                                    boolean l=false;
    
    
      GameKeyboard()
      {
      KeyboardFocusManager.getCurrentKeyboardFocusManager()
        .addKeyEventDispatcher(this);
      }
    
      public boolean dispatchKeyEvent( KeyEvent ke )
      {
    
     if(ke.getKeyCode()==UP && ke.getID()==401){
    up=true;
     }
      if(ke.getKeyCode()==UP && ke.getID()==402){
    up=false;
     }
      if(ke.getKeyCode()==DOWN && ke.getID()==401){
    down=true;
     }
      if(ke.getKeyCode()==DOWN && ke.getID()==402){
    down=false;
     }
     
     
      if(ke.getKeyCode()==RIGHT && ke.getID()==401){
    right=true;
     }
      if(ke.getKeyCode()==RIGHT && ke.getID()==402){
    right=false;
     }
     
      
      if(ke.getKeyCode()==LEFT && ke.getID()==401){
    left=true;
     }
      if(ke.getKeyCode()==LEFT && ke.getID()==402){
    left=false;
     }
       if(ke.getKeyChar()== 'a' && ke.getID()==401){
    a=true;
     }
        if(ke.getKeyChar()== 'a' && ke.getID()==402){
    a=false;
     }
        if(ke.getKeyChar()== 'd' && ke.getID()==401){
    d=true;
     }
        if(ke.getKeyChar()== 'd' && ke.getID()==402){
    d=false;
     }
        if(ke.getKeyChar()== 's' && ke.getID()==401){
    s=true;
     }
        if(ke.getKeyChar()== 's' && ke.getID()==402){
    s=false;
     }
        if(ke.getKeyChar()== 'w' && ke.getID()==401){
    w=true;
     }
        if(ke.getKeyChar()== 'w' && ke.getID()==402){
    w=false;
     }
    
        if(ke.getKeyChar()== 'j' && ke.getID()==401){
                              j=true;
     }
        if(ke.getKeyChar()== 'j' && ke.getID()==402){
                              j=false;
     }
        if(ke.getKeyChar()== 'l' && ke.getID()==401){
                              l=true;
     }
        if(ke.getKeyChar()== 'l' && ke.getID()==402){
                              l=false;
     }
        if(ke.getKeyChar()== 'k' && ke.getID()==401){
                              k=true;
     }
        if(ke.getKeyChar()== 'k' && ke.getID()==402){
                              k=false;
     }
     
         if(ke.getKeyChar()== 'i' && ke.getID()==401){
                              i=true;
     }
        if(ke.getKeyChar()== 'i' && ke.getID()==402){
                              i=false;
     }
     
     
     
     // CAPS LOCK *******************************************
     
        if(ke.getKeyChar()== 'A' && ke.getID()==401){
    a=true;
     }
        if(ke.getKeyChar()== 'A' && ke.getID()==402){
    a=false;
     }
        if(ke.getKeyChar()== 'D' && ke.getID()==401){
    d=true;
     }
        if(ke.getKeyChar()== 'D' && ke.getID()==402){
    d=false;
     }
        if(ke.getKeyChar()== 'S' && ke.getID()==401){
    s=true;
     }
        if(ke.getKeyChar()== 'S' && ke.getID()==402){
    s=false;
     }
        if(ke.getKeyChar()== 'W' && ke.getID()==401){
    w=true;
     }
        if(ke.getKeyChar()== 'W' && ke.getID()==402){
    w=false;
     }
    
        if(ke.getKeyChar()== 'J' && ke.getID()==401){
                              j=true;
     }
        if(ke.getKeyChar()== 'J' && ke.getID()==402){
                              j=false;
     }
        if(ke.getKeyChar()== 'L' && ke.getID()==401){
                              l=true;
     }
        if(ke.getKeyChar()== 'L' && ke.getID()==402){
                              l=false;
     }
        if(ke.getKeyChar()== 'K' && ke.getID()==401){
                              k=true;
     }
        if(ke.getKeyChar()== 'K' && ke.getID()==402){
                              k=false;
     }
     
         if(ke.getKeyChar()== 'I' && ke.getID()==401){
                              i=true;
     }
        if(ke.getKeyChar()== 'I' && ke.getID()==402){
                              i=false;
     }
         if(ke.getKeyChar()== ' ' && ke.getID()==401){
    space=true;
     }
        if(ke.getKeyChar()== ' ' && ke.getID()==402){
    space=false;
     }
        ke.consume();
    return true;
      }//dispatcher
      
      
      void display(){
       text("left "+left,40,140); 
          text("right "+right,300,140); 
             text("up "+up,150,100); 
                text("down "+down,150,140); 
        translate(0,100);
           text("a "+a,40,140); 
          text("d "+d,300,140); 
             text("w "+w,150,100); 
                text("s "+s,150,140); 
                    translate(0,100);
           text("j "+j,40,140); 
          text("l "+l,300,140); 
             text("i "+i,150,100); 
                text("k "+k,150,140); 
      }
    }//class
    
    
    
    
    
    
    GameKeyboard kb = new GameKeyboard();
    hydroplane hydro = new hydroplane();
    ball[] balls= new ball[20];
    cdot[] dots = new cdot[400];
    wake[] wak = new wake[20];
    int nextwak = 0;
    PVector last1 = new PVector(0.0,0.0,0.0);PVector last2 = new PVector(0.0,0.0,0.0);
    PVector cam = new PVector(0.0,0.0,0.0);
    float wavy = 0.0;
    missl[] missle = new missl[20];
    crag[] crags = new crag[20];
    int nextm = 0;
    int nummissles =0;
    int fire=0;
    boolean space;
    PFont fontA;
    
    void setup(){
      
     size(600,380,P3D); 
     frameRate(15);
       fontA = loadFont("CourierNew36.vlw");
       textAlign(CENTER);  textFont(fontA, 32);
     for(int i=0;i<balls.length;i++){
      balls[i] = new ball();
     balls[i].xp = random(200.f)-100.f;
     balls[i].yp = random(200.f)-150.f; 
     }
     
      for(int i=0;i<crags.length;i++){
      crags[i] = new crag();
     crags[i].xp = random(200.f)-100.f;
     crags[i].yp = random(200.f)-150.f; 
     }
     for(int i=0;i<dots.length;i++){
       dots[i] = new cdot(i,dots.length);
     }
     for(int i=0;i<missle.length;i++){
      missle[i]=new missl(hydro); 
     }
     for(int i=0;i<wak.length;i++){
      wak[i]=new wake(hydro); 
     }
    //hydro.xv =0.01;
    }
    
    void draw(){
      background(120,120,120);
    //lights();
    
      fill(60,90,100);
      noStroke();
    //  pushMatrix();
    //  translate(width/2,height/2,10);
    // box(1900);
    // 
    // popMatrix();
     pushMatrix();
    translate(width/2, height/2, -3000);
    //rotateY(1.25);
    rotateX(60);
    box(9000,4500,10);
    popMatrix();
      stroke(0);
    //  pushMatrix();
    //  translate(width/2,height/2,0);
    //  
    //  scale(50.0,50.0,50.0);
    //// translate(cam.x,cam.y,cam.z);
    //  rotateX(radians(60));
        wavy += 0.09;
    
      
    //  popMatrix();
    
    //  resetMatrix();
    //    translate(width/2,height/2,0);
    //  scale(50.0,50.0,50.0);
    //  rotateX(radians(60));
    //   translate(cam.x,cam.y,cam.z);
        for(int i=0;i<dots.length;i++){
    //           pushMatrix();
    //  pushMatrix();
    //  translate(width/2,height/2,0);
    //  
    //  scale(50.0,50.0,50.0);
    //// translate(cam.x,cam.y,cam.z);
    //  rotateX(radians(60));
         dots[i].draw();
    //     popMatrix();
        }
        stroke(0);
       for(int i=0;i<balls.length;i++){
    
         balls[i].draw();
         if(hydro.collision==0 && balls[i].collide(hydro)){
    
         hydro.collision=4;
        hydro.xp-=hydro.mv*2.0*cos(hydro.theta);
       hydro.yp-=hydro.mv*2.0*sin(hydro.theta); 
             hydro.mv =0.0;
         }
    
       }
          for(int i=0;i<crags.length;i++){
    
         crags[i].draw();
         if(hydro.collision==0 && crags[i].collide(hydro)){
    
         hydro.collision=4;
        hydro.xp-=hydro.mv*2.0*cos(hydro.theta);
       hydro.yp-=hydro.mv*2.0*sin(hydro.theta); 
             hydro.mv =0.0;
         }
    
       }
      
    //     resetMatrix();
    //    translate(width/2,height/2,0);
    //  scale(50.0,50.0,50.0);
    //  rotateX(radians(60));
    //   translate(cam.x,cam.y,cam.z);
          hydro.draw();
    
    if(fire>0){
    //  if(missle[(nextm+1)] == null){
    //   missle[nextm++] = new missl(hydro);
    //
    //  if(nextm>18){nextm=0;nummissles=19;}else{
    //     nummissles++; 
    //  }
    //  }else{
          missle[nextm++].refire(hydro);
            if(nextm>18){nextm=0;nummissles=19;}else{
         nummissles++; 
      }
    //  }
     if(!space)fire--; 
    }
    if(nummissles>0){
    for(int i=0;i<missle.length;i++){
      
     missle[i].draw();
     for(int j=0;j<balls.length;j++){
     if(missle[i].collide(balls[j])){
      balls[j].explode(); 
     }
     }
     
     for(int j=0;j<crags.length;j++){
     missle[i].collide(crags[j]);
     
     
     }
    }
    }
    last1.x=0.0;last1.y=0.0;last1.z=0.0;
    last2.x=0.0;last2.y=0.0;last2.z=0.0;
    //lastw.x=hydro.xp-cam.x;lastw.y=hydro.yp-cam.y;lastw.z=hydro.zp-cam.z;
    for(int i=0;i<wak.length;i++){
     wak[i].draw(); 
    }
    nextwak++;
    nextwak%=wak.length;
    wak[nextwak].refire(hydro);
    
          cam.x = ((cam.x*5.0)-(hydro.xp+hydro.xv*8.0)) / 6.0;
      cam.y = ((cam.y*5.0)-(hydro.yp+hydro.yv*2.0)+(abs(hydro.mv)/10.0)) / 6.0 ;
      if(hydro.yv>0.0){
          cam.y = ((cam.y*14.0)-(hydro.yp+hydro.yv*9.0)-(abs(hydro.mv)*12.0)) / 15.0 ;
      }
      cam.z = (cam.z*3.0 -(abs(hydro.mv)/20.0)+1.0)/4.0;//(sin(wavy = (wavy + 0.1)%TWO_PI)+cos(wavy*3.0%TWO_PI))/10.0;
    handleKeys();
    fill(200);
    text("Level 1 \n Clear Mines ",width/2,height-height/5,0);
    }
    
    //void keyPressed(){
    // switch(key){
    //  case 'i':
    //  hydro.mv +=0.05;
    //  break;
    //  case 'k':
    //  hydro.mv -=0.05;break;
    //  case 'j':
    //  hydro.zrv -= 0.025/(abs(hydro.zrv)+0.5);
    ////  hydro.zrv *= (abs(20*hydro.mv)+3.0)/10.0;
    //  break;
    //  case'l':
    //  hydro.zrv +=0.025/(abs(hydro.zrv)+0.5);
    ////    hydro.zrv *= (abs(20*hydro.mv)+3.0)/10.0;
    //  break;
    //  case' ':
    //  fire++;
    //space=true;
    //  break;
    // } 
    //  
    //}
    
    //void keyReleased(){
    // switch(key){
    //  case' ':
    //  space=false;
    //  break;
    // } 
    //  
    //}
    void handleKeys(){
     if(kb.up){
        hydro.mv +=0.05;
     }else if(kb.down){
        hydro.mv -=0.05;
     } 
     if(kb.left){
        hydro.zrv -= 0.025/(abs(hydro.zrv)+0.5); 
     }else if(kb.right){
        hydro.zrv += 0.025/(abs(hydro.zrv)+0.5); 
     }
     if(kb.space){
      fire++;
     space=true; 
    // println("space");
     }else{
      space=false;  
     }
    }
    
    class cdot extends mover{
      
        float origx=0.0;
        float origy=0.0;
        float lastwaves=0.0;
        float wavediff=0.0;
        float row=0.0;
        float lx=0,ly=0,lz=0;
    
      cdot(){
      xp=random(1000.0)-500.0;
    yp=(random(100.0)-90.0)+(random(100.0)-90.0)+(random(100.0)-90.0);
    
         origx=xp;
        origy=yp;
    };
    
      cdot(int i,int max){
        row = (float)max/40.0;
      xp=(((float)i)%row)*(8.0)-40.0+((float)i)/(20.0);
    yp = ((round((float)i)/row)* -2)+18;
    
         origx=xp;
         origy=yp;
      }
    
      void draw(){
        
        stroke(90,90,200);
        xp += (cam.x%2.0)-1.0;// +(wavy%0.18)*13.0+(wavy%0.36)*6.0;
        yp += (cam.y%(row-1.44))-row/2.0;
        if(cam.y%row>=0.05)lastwaves=waves;
    for(int i=0; i<44;i++){
      prequel();
     pushMatrix();
    //   super.calcyThing();
    
       updateDraw();
    //   translate(-cam.x,-cam.y,-cam.z);
         if(modelY(xp,yp,zp)<400.0 && modelY(xp,yp,zp)> -3400.0){
         wavediff = waves-lastwaves;
    //translate( (cam.x%2.0)-1.0 ,(cam.y%4.0)-2.0,0);
         
         if(wavediff>(0.05)){stroke(90,210,240);}else{stroke(20,90,200);}
         if(waves<(-0.09)){stroke(20,70,80);}else{
           if(waves>(0.08)){
           stroke(90,130,210);
         }}
         strokeWeight(1.0);
           beginShape(LINES);
    
    vertex(  0.0	,0.0	,0.0);	vertex(0.1	,0.0	,0.0);
    //vertex(  0.4	,0.0	,0.1);	vertex(0.8	,0.0	,0.0);
    endShape();
         }
    //     lx = screenX(0.,0.,0.);
         if(origx%2.0<1.0){
         xp +=(0.8 +(float)(((float)i*5.0)%3.0))/2.0;
         yp +=(0.8 - (float)(((float)i*7.0)%3.0));
         }else{
                xp -=(0.8 +(float)(((float)i*5.0)%3.0))/2.0;
         yp +=(0.8 - (float)(((float)i*7.0)%3.0));
         }
         popMatrix();
          lastwaves = waves; 
       postop();   
    }
    yp=origy;
    xp=origx;
    strokeWeight(1.0);
      }
      
      void updateDraw(){
             updateRot();updateVelMV_Z();updatePos();
    
    
          xp-=cam.x;yp-=cam.y;
                calcyThing();
                   xp+=cam.x;yp+=cam.y;
    //      wavept = sin(((9.0*xp+(yp/100.0))/33.0-((wavy*3.0)%TWO_PI))%TWO_PI) + sin(((6.0*yp-(xp/70.0))/45.9-((wavy+3)*3.0)%TWO_PI)%TWO_PI);
    //      waves = (waves*3.0+((wavept))/2.0)/4.0;
        translate(xp,yp,zp+waves/2.0);
        rotateX(xr);rotateY(yr);rotateZ(zr); 
      }
    }//class
    
    class ball extends mover{
    //      boolean exploding=false;
        int explode=0;
    // ****************************************************** 
    // ****************************************************** 
    // ****************************************************** 
    ball(){;}
    
    void draw(){
      if(!exploding){
        stroke(0);
      prequel();
      super.updateDraw();
      pushMatrix();
                   translate(0.,0.0,-2.3);
    
    //  translate(0.0,0.0,-2.0);
      if(modelY(xp+cam.x,yp+cam.y,zp+cam.z)<400.0){
    
    beginShape(LINES);
    
    vertex(  0.0	,0.2	,0.0);	vertex(0.0	,0.2	,0.0);
    vertex(  0.0	,0.2	,0.0);	vertex(0.2	,0.2	,0.0);
    vertex(  0.2	,0.2	,0.0);	vertex(0.4	,0.1	,0.0);
    vertex(  0.4	,0.1	,0.0);	vertex(0.5	,0.0	,0.0);
    vertex(  0.5	,0.0	,0.0);	vertex(0.6	,-0.2	,0.0);
    vertex(  0.6	,-0.2	,0.0);	vertex(0.6	,-0.5	,0.0);
    vertex(  0.6	,-0.5	,0.0);	vertex(0.5	,-0.7	,0.0);
    vertex(  0.5	,-0.7	,0.0);	vertex(0.4	,-0.8	,0.0);
    vertex(  0.4	,-0.8	,0.0);	vertex(0.2	,-0.9	,0.0);
    vertex(  0.2	,-0.9	,0.0);	vertex(0.0	,-0.9	,0.0);
    vertex(  0.0	,-0.9	,0.0);	vertex(0.0	,-0.9	,0.2);
    vertex(  0.0	,-0.9	,0.2);	vertex(0.0	,-0.8	,0.4);
    vertex(  0.0	,-0.8	,0.4);	vertex(0.0	,-0.7	,0.5);
    vertex(  0.0	,-0.7	,0.5);	vertex(0.0	,-0.5	,0.6);
    vertex(  0.0	,-0.5	,0.6);	vertex(0.0	,-0.2	,0.6);
    vertex(  0.0	,-0.2	,0.6);	vertex(0.0	,0.0	,0.5);
    vertex(  0.0	,0.0	,0.5);	vertex(0.0	,0.1	,0.4);
    vertex(  0.0	,0.1	,0.4);	vertex(0.0	,0.2	,0.2);
    vertex(  0.0	,0.2	,0.2);	vertex(0.0	,0.2	,0.0);
    vertex(  0.0	,0.2	,0.0);	vertex(0.0	,0.2	,-0.2);
    vertex(  0.0	,0.2	,-0.2);	vertex(0.0	,0.1	,-0.4);
    vertex(  0.0	,0.1	,-0.4);	vertex(0.0	,0.0	,-0.5);
    vertex(  0.0	,0.0	,-0.5);	vertex(0.0	,-0.2	,-0.6);
    vertex(  0.0	,-0.2	,-0.6);	vertex(0.0	,-0.5	,-0.6);
    vertex(  0.0	,-0.5	,-0.6);	vertex(0.0	,-0.7	,-0.5);
    vertex(  0.0	,-0.7	,-0.5);	vertex(0.0	,-0.8	,-0.4);
    vertex(  0.0	,-0.8	,-0.4);	vertex(0.0	,-0.9	,-0.2);
    vertex(  0.0	,-0.9	,-0.2);	vertex(0.0	,-0.9	,0.0);
    vertex(  0.0	,-0.9	,0.0);	vertex(0.1	,-0.9	,0.2);
    vertex(  0.1	,-0.9	,0.2);	vertex(0.1	,-0.8	,0.4);
    vertex(  0.1	,-0.8	,0.4);	vertex(0.1	,-0.7	,0.5);
    vertex(  0.1	,-0.7	,0.5);	vertex(0.1	,-0.5	,0.6);
    vertex(  0.1	,-0.5	,0.6);	vertex(0.1	,-0.2	,0.6);
    vertex(  0.1	,-0.2	,0.6);	vertex(0.1	,0.0	,0.5);
    vertex(  0.1	,0.0	,0.5);	vertex(0.1	,0.1	,0.4);
    vertex(  0.1	,0.1	,0.4);	vertex(0.1	,0.2	,0.2);
    vertex(  0.1	,0.2	,0.2);	vertex(0.1	,0.2	,0.0);
    vertex(  0.1	,0.2	,0.0);	vertex(0.1	,0.2	,-0.2);
    vertex(  0.1	,0.2	,-0.2);	vertex(0.1	,0.1	,-0.4);
    vertex(  0.1	,0.1	,-0.4);	vertex(0.1	,0.0	,-0.5);
    vertex(  0.1	,0.0	,-0.5);	vertex(0.1	,-0.2	,-0.6);
    vertex(  0.1	,-0.2	,-0.6);	vertex(0.1	,-0.5	,-0.6);
    vertex(  0.1	,-0.5	,-0.6);	vertex(0.1	,-0.7	,-0.5);
    vertex(  0.1	,-0.7	,-0.5);	vertex(0.1	,-0.8	,-0.4);
    vertex(  0.1	,-0.8	,-0.4);	vertex(0.1	,-0.9	,-0.2);
    vertex(  0.1	,-0.9	,-0.2);	vertex(0.1	,-0.9	,0.0);
    vertex(  0.1	,-0.9	,0.0);	vertex(0.2	,-0.9	,0.1);
    vertex(  0.2	,-0.9	,0.1);	vertex(0.3	,-0.8	,0.3);
    vertex(  0.3	,-0.8	,0.3);	vertex(0.3	,-0.7	,0.4);
    vertex(  0.3	,-0.7	,0.4);	vertex(0.3	,-0.5	,0.5);
    vertex(  0.3	,-0.5	,0.5);	vertex(0.3	,-0.2	,0.5);
    vertex(  0.3	,-0.2	,0.5);	vertex(0.3	,0.0	,0.4);
    vertex(  0.3	,0.0	,0.4);	vertex(0.3	,0.1	,0.3);
    vertex(  0.3	,0.1	,0.3);	vertex(0.2	,0.1	,0.1);
    vertex(  0.2	,0.1	,0.1);	vertex(0.0	,0.2	,0.0);
    vertex(  0.0	,0.2	,0.0);	vertex(0.1	,0.2	,0.0);
    vertex(  0.1	,0.2	,0.0);	vertex(0.2	,0.2	,-0.2);
    vertex(  0.2	,0.2	,-0.2);	vertex(0.2	,0.1	,-0.4);
    vertex(  0.2	,0.1	,-0.4);	vertex(0.3	,-0.1	,-0.5);
    vertex(  0.3	,-0.1	,-0.5);	vertex(0.3	,-0.6	,-0.5);
    vertex(  0.3	,-0.6	,-0.5);	vertex(0.3	,-0.7	,-0.4);
    vertex(  0.3	,-0.7	,-0.4);	vertex(0.2	,-0.8	,-0.2);
    vertex(  0.2	,-0.8	,-0.2);	vertex(0.1	,-0.9	,0.0);
    vertex(  0.1	,-0.9	,0.0);	vertex(0.4	,-0.8	,0.1);
    vertex(  0.4	,-0.8	,0.1);	vertex(0.5	,-0.5	,0.2);
    vertex(  0.5	,-0.5	,0.2);	vertex(0.5	,-0.1	,0.2);
    vertex(  0.5	,-0.1	,0.2);	vertex(0.4	,0.1	,0.1);
    vertex(  0.4	,0.1	,0.1);	vertex(0.2	,0.2	,0.0);
    endShape();
    
     // \ *****************
    //MIRROR  
    //************************************* 
     
     beginShape(LINES);
    vertex(  -0.0	,0.2	,0.0);	vertex(-0.2	,0.2	,0.0);
    vertex(  -0.2	,0.2	,0.0);	vertex(-0.4	,0.1	,0.0);
    vertex(  -0.4	,0.1	,0.0);	vertex(-0.5	,0.0	,0.0);
    vertex(  -0.5	,0.0	,0.0);	vertex(-0.6	,-0.2	,0.0);
    vertex(  -0.6	,-0.2	,0.0);	vertex(-0.6	,-0.5	,0.0);
    vertex(  -0.6	,-0.5	,0.0);	vertex(-0.5	,-0.7	,0.0);
    vertex(  -0.5	,-0.7	,0.0);	vertex(-0.4	,-0.8	,0.0);
    vertex(  -0.4	,-0.8	,0.0);	vertex(-0.2	,-0.9	,0.0);
    vertex(  -0.2	,-0.9	,0.0);	vertex(-0.0	,-0.9	,0.0);
    vertex(  -0.0	,-0.9	,0.0);	vertex(-0.0	,-0.9	,0.2);
    vertex(  -0.0	,-0.9	,0.2);	vertex(-0.0	,-0.8	,0.4);
    vertex(  -0.0	,-0.8	,0.4);	vertex(-0.0	,-0.7	,0.5);
    vertex(  -0.0	,-0.7	,0.5);	vertex(-0.0	,-0.5	,0.6);
    vertex(  -0.0	,-0.5	,0.6);	vertex(-0.0	,-0.2	,0.6);
    vertex(  -0.0	,-0.2	,0.6);	vertex(-0.0	,0.0	,0.5);
    vertex(  -0.0	,0.0	,0.5);	vertex(-0.0	,0.1	,0.4);
    vertex(  -0.0	,0.1	,0.4);	vertex(-0.0	,0.2	,0.2);
    vertex(  -0.0	,0.2	,0.2);	vertex(-0.0	,0.2	,0.0);
    vertex(  -0.0	,0.2	,0.0);	vertex(-0.0	,0.2	,-0.2);
    vertex(  -0.0	,0.2	,-0.2);	vertex(-0.0	,0.1	,-0.4);
    vertex(  -0.0	,0.1	,-0.4);	vertex(-0.0	,0.0	,-0.5);
    vertex(  -0.0	,0.0	,-0.5);	vertex(-0.0	,-0.2	,-0.6);
    vertex(  -0.0	,-0.2	,-0.6);	vertex(-0.0	,-0.5	,-0.6);
    vertex(  -0.0	,-0.5	,-0.6);	vertex(-0.0	,-0.7	,-0.5);
    vertex(  -0.0	,-0.7	,-0.5);	vertex(-0.0	,-0.8	,-0.4);
    vertex(  -0.0	,-0.8	,-0.4);	vertex(-0.0	,-0.9	,-0.2);
    vertex(  -0.0	,-0.9	,-0.2);	vertex(-0.0	,-0.9	,0.0);
    vertex(  -0.0	,-0.9	,0.0);	vertex(-0.1	,-0.9	,0.2);
    vertex(  -0.1	,-0.9	,0.2);	vertex(-0.1	,-0.8	,0.4);
    vertex(  -0.1	,-0.8	,0.4);	vertex(-0.1	,-0.7	,0.5);
    vertex(  -0.1	,-0.7	,0.5);	vertex(-0.1	,-0.5	,0.6);
    vertex(  -0.1	,-0.5	,0.6);	vertex(-0.1	,-0.2	,0.6);
    vertex(  -0.1	,-0.2	,0.6);	vertex(-0.1	,0.0	,0.5);
    vertex(  -0.1	,0.0	,0.5);	vertex(-0.1	,0.1	,0.4);
    vertex(  -0.1	,0.1	,0.4);	vertex(-0.1	,0.2	,0.2);
    vertex(  -0.1	,0.2	,0.2);	vertex(-0.1	,0.2	,0.0);
    vertex(  -0.1	,0.2	,0.0);	vertex(-0.1	,0.2	,-0.2);
    vertex(  -0.1	,0.2	,-0.2);	vertex(-0.1	,0.1	,-0.4);
    vertex(  -0.1	,0.1	,-0.4);	vertex(-0.1	,0.0	,-0.5);
    vertex(  -0.1	,0.0	,-0.5);	vertex(-0.1	,-0.2	,-0.6);
    vertex(  -0.1	,-0.2	,-0.6);	vertex(-0.1	,-0.5	,-0.6);
    vertex(  -0.1	,-0.5	,-0.6);	vertex(-0.1	,-0.7	,-0.5);
    vertex(  -0.1	,-0.7	,-0.5);	vertex(-0.1	,-0.8	,-0.4);
    vertex(  -0.1	,-0.8	,-0.4);	vertex(-0.1	,-0.9	,-0.2);
    vertex(  -0.1	,-0.9	,-0.2);	vertex(-0.1	,-0.9	,0.0);
    vertex(  -0.1	,-0.9	,0.0);	vertex(-0.2	,-0.9	,0.1);
    vertex(  -0.2	,-0.9	,0.1);	vertex(-0.3	,-0.8	,0.3);
    vertex(  -0.3	,-0.8	,0.3);	vertex(-0.3	,-0.7	,0.4);
    vertex(  -0.3	,-0.7	,0.4);	vertex(-0.3	,-0.5	,0.5);
    vertex(  -0.3	,-0.5	,0.5);	vertex(-0.3	,-0.2	,0.5);
    vertex(  -0.3	,-0.2	,0.5);	vertex(-0.3	,0.0	,0.4);
    vertex(  -0.3	,0.0	,0.4);	vertex(-0.3	,0.1	,0.3);
    vertex(  -0.3	,0.1	,0.3);	vertex(-0.2	,0.1	,0.1);
    vertex(  -0.2	,0.1	,0.1);	vertex(-0.0	,0.2	,0.0);
    vertex(  -0.0	,0.2	,0.0);	vertex(-0.1	,0.2	,0.0);
    vertex(  -0.1	,0.2	,0.0);	vertex(-0.2	,0.2	,-0.2);
    vertex(  -0.2	,0.2	,-0.2);	vertex(-0.2	,0.1	,-0.4);
    vertex(  -0.2	,0.1	,-0.4);	vertex(-0.3	,-0.1	,-0.5);
    vertex(  -0.3	,-0.1	,-0.5);	vertex(-0.3	,-0.6	,-0.5);
    vertex(  -0.3	,-0.6	,-0.5);	vertex(-0.3	,-0.7	,-0.4);
    vertex(  -0.3	,-0.7	,-0.4);	vertex(-0.2	,-0.8	,-0.2);
    vertex(  -0.2	,-0.8	,-0.2);	vertex(-0.1	,-0.9	,0.0);
    vertex(  -0.1	,-0.9	,0.0);	vertex(-0.4	,-0.8	,0.1);
    vertex(  -0.4	,-0.8	,0.1);	vertex(-0.5	,-0.5	,0.2);
    vertex(  -0.5	,-0.5	,0.2);	vertex(-0.5	,-0.1	,0.2);
    vertex(  -0.5	,-0.1	,0.2);	vertex(-0.4	,0.1	,0.1);
    vertex(  -0.4	,0.1	,0.1);	vertex(-0.2	,0.2	,0.0);
    
    
    endShape();
    }
    popMatrix();
    postop();
      }else{
       //exploding 
        if(explode>0){
         //draw explosion
    
          stroke(255,255,90);
    //      strokeWeight(2);
          prequel();
          updateDraw();
                       translate(0.,0.0,-2.3);
                                      scale(5.0-((float)explode/2.0),5.0-((float)explode/2.0),5.0-((float)explode/2.0));
          for(int i=0;i<4;i++){
          rotateX(random(PI)+1);
          rotateY(random(PI)+1);
          rotateZ(random(PI)+1);
      // ****************************************************** 
    // ****************************************************** 
    // ****************************************************** 
    
    {
    beginShape(LINES);
    
    vertex(  -0.12	,0.64	,0.0);	vertex(0.64	,-0.71	,0.0);
    vertex(  0.64	,-0.71	,0.0);	vertex(-0.95	,-0.45	,0.0);
    vertex(  -0.95	,-0.45	,0.0);	vertex(0.27	,0.59	,0.0);
    vertex(  0.27	,0.59	,0.0);	vertex(0.2	,-0.89	,0.0);
    vertex(  0.2	,-0.89	,0.0);	vertex(-1.02	,-0.06	,0.0);
    vertex(  -1.02	,-0.06	,0.0);	vertex(0.56	,0.33	,0.0);
    vertex(  0.56	,0.33	,0.0);	vertex(-0.29	,-0.89	,0.0);
    vertex(  -0.29	,-0.89	,0.0);	vertex(-0.98	,0.2	,0.0);
    vertex(  -0.98	,0.2	,0.0);	vertex(0.64	,0.0	,0.0);
    vertex(  0.64	,0.0	,0.0);	vertex(-0.74	,-0.84	,0.0);
    vertex(  -0.74	,-0.84	,0.0);	vertex(-0.65	,0.5	,0.0);
    vertex(  -0.65	,0.5	,0.0);	vertex(0.69	,-0.34	,0.0);
    vertex(  0.69	,-0.34	,0.0);	vertex(-0.89	,-0.69	,0.0);
    vertex(  -0.89	,-0.69	,0.0);	vertex(-0.15	,0.63	,0.0);
    endShape();
    
     // \ *****************
    //MIRROR  
    //************************************* 
     
     beginShape(LINES);
    
    endShape();
    }
    
    
      
          }
         explode--; 
         postop();
        }
      }
    }
    
    void explode(){
      if(!exploding){
     exploding=true;
     explode=3;
      }
      
    }
    
    boolean collide(mover target){
     if(!exploding){
      return super.collide(target);
     } else{
      return false; 
     }
    }
    
    
    }//class
    
    
    class crag extends ball{
      float waterline =0.0;
      void explode(){
    ;
    }
    void draw(){
     if(!exploding){
        stroke(0);
      prequel();
      super.updateDraw();
      pushMatrix();
                   translate(0.,0.0,-1.7-(waves/2));
    //    translate(0.,0.5+hydro.mv,-1.4-(waves/2));
    //  translate(0.0,0.0,-2.0);
      if(modelY(xp+cam.x,yp+cam.y,zp+cam.z)<400.0){
        waterline = calcyThing(-1.0,-1.0)/2.0;
        line(-1,-1,waterline,-1,-1,1.5);  
          waterline = calcyThing(-1.f,1.f)/2.0;  
        line(-1,1,waterline,-1,1,1.5);   
              waterline = calcyThing(1.f,-1.f)/2.0;  
        line(1,-1,waterline,1,-1,1.5);   
              waterline = calcyThing(1.f,1.f)/2.0;  
        line(1,1,waterline,1,1,1.5);
            line(-1,-1,1.5,-1,1,1.5);    
        line(-1,1,1.5,1,1,1.5);   
        line(1,1,1.5,1,-1,1.5);   
        line(1,-1,1.5,-1,-1,1.5);
      }
      popMatrix();
      postop();
     }
    }//draw
    
    }//class
    
    class hydroplane extends mover{
      float temp=0.0;
      float z1=0.0,z2=0.0,z3=0.0,z4=0.0;
      int collision=0;
      hydroplane(){
        ;
      }//constr
    
    void draw()// ****************************************************** 
    // ****************************************************** 
    // ****************************************************** 
    
    {
    prequel();
    //      updateRot();updateVelMV_Z();updatePos();
    //      wavept = sin(((5.0*xp+(yp/100.0))/23.0-((wavy*3.0)%TWO_PI))%TWO_PI) + sin(((6.0*yp-(xp/70.0))/25.9-((wavy+3)*3.0)%TWO_PI)%TWO_PI);
    //      waves = (waves*8.0+((wavept*TWO_PI*2.0)%TWO_PI)/2.0)/9.0;
    //    translate(xp+cam.x,yp+cam.y,zp+cam.z+waves/6.0);
    //    rotateX(xr);rotateY(yr);rotateZ(zr);
      zrv *=0.9;
      stroke(0);
      strokeWeight(1.0);
      pushMatrix();
        super.updateDraw();
        translate(0.,0.5+hydro.mv,-1.7);
        pushMatrix();
        z1 = calcyThing(xp-0.4,yp);
        z2 = calcyThing(xp+0.4,yp);
        z3 = calcyThing(xp,yp-0.6);
        z4 = calcyThing(xp,yp+0.6);
    //    if(z1>z3){
    //     if(z2>z4){
    //      rotateX((z1-z3));
    //     }else{
    //      rotateY(z1-z3);
    //     } 
    //      
    //    }else{
    //           if(z2>z4){
    //      rotateX(z2-z4);
    //     }else{
    //      rotateY(z2-z4);
    //     } 
    //    }
        xr = ((xr*3.0)+(z4-z3))/(5.0+mv);
        yr = ((yr*3.0)+(z2-z1))/(5.0+mv);
    //scale(0.5,0.5,0.5);
    //{
    //       updateRot();updateVelMV_Z();updatePos();
    ////       temp=xp; xp = yp; yp = temp;
    //      calcyThing();
    ////             temp=xp; xp = yp; yp = temp;
    ////      wavept = sin(((9.0*xp+(yp/100.0))/33.0-((wavy*3.0)%TWO_PI))%TWO_PI) + sin(((6.0*yp-(xp/70.0))/45.9-((wavy+3)*3.0)%TWO_PI)%TWO_PI);
    ////      waves = (waves*3.0+((wavept))/2.0)/4.0;
    //    translate(xp+cam.x,yp+cam.y,zp+cam.z+waves/1.0);
    //    rotateX(xr);rotateY(yr);rotateZ(zr); 
    //}
    beginShape(LINES);
    
    vertex(  0.0	,0.3	,0.0);	vertex(-0.2	,0.2	,0.0);
    vertex(  -0.2	,0.2	,0.0);	vertex(-0.3	,0.0	,0.0);
    vertex(  -0.3	,0.0	,0.0);	vertex(-0.4	,-0.3	,0.0);
    vertex(  -0.4	,-0.3	,0.0);	vertex(-0.4	,-1.0	,0.0);
    vertex(  -0.4	,-1.0	,0.0);	vertex(-0.3	,-1.4	,0.0);
    vertex(  -0.3	,-1.4	,0.0);	vertex(-0.2	,-1.5	,0.0);
    vertex(  -0.2	,-1.5	,0.0);	vertex(0.0	,-1.6	,0.0);
    vertex(  0.0	,-1.6	,0.0);	vertex(0.1	,-1.5	,0.0);
    vertex(  0.1	,-1.5	,0.0);	vertex(0.2	,-1.2	,-0.1);
    vertex(  0.2	,-1.2	,-0.1);	vertex(0.2	,-0.7	,-0.2);
    vertex(  0.2	,-0.7	,-0.2);	vertex(0.1	,-0.1	,-0.1);
    vertex(  0.1	,-0.1	,-0.1);	vertex(0.0	,0.2	,0.0);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    
    
    vertex(  0.6	,0.2	,0.0);	vertex(0.7	,0.0	,0.0);
    vertex(  0.7	,0.0	,0.0);	vertex(0.8	,-0.7	,0.0);
    vertex(  0.8	,-0.7	,0.0);	vertex(0.7	,-1.5	,0.0);
    vertex(  0.7	,-1.5	,0.0);	vertex(0.6	,-1.6	,0.0);
    vertex(  0.6	,-1.6	,0.0);	vertex(0.5	,-1.5	,0.0);
    vertex(  0.5	,-1.5	,0.0);	vertex(0.5	,-0.7	,0.0);
    vertex(  0.5	,-0.7	,0.0);	vertex(0.5	,0.0	,0.0);
    vertex(  0.5	,0.0	,0.0);	vertex(0.6	,0.2	,0.0);
    vertex(  0.6	,0.2	,0.0);	vertex(0.6	,0.0	,-0.1);
    vertex(  0.6	,0.0	,-0.1);	vertex(0.6	,-1.5	,-0.1);
    vertex(  0.6	,-1.5	,-0.1);	vertex(0.6	,-1.6	,0.0);
    vertex(  0.6	,-1.6	,0.0);	vertex(0.6	,-1.5	,0.1);
    vertex(  0.6	,-1.5	,0.1);	vertex(0.6	,-0.6	,0.2);
    vertex(  0.6	,-0.6	,0.2);	vertex(0.6	,0.1	,0.1);
    vertex(  0.6	,0.1	,0.1);	vertex(0.6	,0.2	,0.0);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    
    
    vertex(  0.2	,0.2	,0.0);	vertex(0.3	,-0.3	,0.1);
    vertex(  0.3	,-0.3	,0.1);	vertex(0.3	,-1.1	,0.1);
    vertex(  0.3	,-1.1	,0.1);	vertex(0.2	,-1.4	,0.1);
    vertex(  0.2	,-1.4	,0.1);	vertex(0.0	,-1.6	,0.0);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    
    
    vertex(  0.0	,0.1	,0.2);	vertex(0.4	,0.1	,0.2);
    vertex(  0.4	,0.1	,0.2);	vertex(0.6	,0.5	,0.1);
    vertex(  0.6	,0.5	,0.1);	vertex(0.0	,0.4	,0.2);
    vertex(  0.0	,0.4	,0.2);	vertex(0.3	,0.1	,0.2);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    endShape();
    
     // \ *****************
    //MIRROR  
    //************************************* 
     
     beginShape(LINES);
    vertex(  -0.0	,0.3	,0.0);	vertex(0.2	,0.2	,0.0);
    vertex(  0.2	,0.2	,0.0);	vertex(0.3	,0.0	,0.0);
    vertex(  0.3	,0.0	,0.0);	vertex(0.4	,-0.3	,0.0);
    vertex(  0.4	,-0.3	,0.0);	vertex(0.4	,-1.0	,0.0);
    vertex(  0.4	,-1.0	,0.0);	vertex(0.3	,-1.4	,0.0);
    vertex(  0.3	,-1.4	,0.0);	vertex(0.2	,-1.5	,0.0);
    vertex(  0.2	,-1.5	,0.0);	vertex(-0.0	,-1.6	,0.0);
    vertex(  -0.0	,-1.6	,0.0);	vertex(-0.1	,-1.5	,0.0);
    vertex(  -0.1	,-1.5	,0.0);	vertex(-0.2	,-1.2	,-0.1);
    vertex(  -0.2	,-1.2	,-0.1);	vertex(-0.2	,-0.7	,-0.2);
    vertex(  -0.2	,-0.7	,-0.2);	vertex(-0.1	,-0.1	,-0.1);
    vertex(  -0.1	,-0.1	,-0.1);	vertex(-0.0	,0.2	,0.0);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    
    
    vertex(  -0.6	,0.2	,0.0);	vertex(-0.7	,0.0	,0.0);
    vertex(  -0.7	,0.0	,0.0);	vertex(-0.8	,-0.7	,0.0);
    vertex(  -0.8	,-0.7	,0.0);	vertex(-0.7	,-1.5	,0.0);
    vertex(  -0.7	,-1.5	,0.0);	vertex(-0.6	,-1.6	,0.0);
    vertex(  -0.6	,-1.6	,0.0);	vertex(-0.5	,-1.5	,0.0);
    vertex(  -0.5	,-1.5	,0.0);	vertex(-0.5	,-0.7	,0.0);
    vertex(  -0.5	,-0.7	,0.0);	vertex(-0.5	,0.0	,0.0);
    vertex(  -0.5	,0.0	,0.0);	vertex(-0.6	,0.2	,0.0);
    vertex(  -0.6	,0.2	,0.0);	vertex(-0.6	,0.0	,-0.1);
    vertex(  -0.6	,0.0	,-0.1);	vertex(-0.6	,-1.5	,-0.1);
    vertex(  -0.6	,-1.5	,-0.1);	vertex(-0.6	,-1.6	,0.0);
    vertex(  -0.6	,-1.6	,0.0);	vertex(-0.6	,-1.5	,0.1);
    vertex(  -0.6	,-1.5	,0.1);	vertex(-0.6	,-0.6	,0.2);
    vertex(  -0.6	,-0.6	,0.2);	vertex(-0.6	,0.1	,0.1);
    vertex(  -0.6	,0.1	,0.1);	vertex(-0.6	,0.2	,0.0);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    
    
    vertex(  -0.2	,0.2	,0.0);	vertex(-0.3	,-0.3	,0.1);
    vertex(  -0.3	,-0.3	,0.1);	vertex(-0.3	,-1.1	,0.1);
    vertex(  -0.3	,-1.1	,0.1);	vertex(-0.2	,-1.4	,0.1);
    vertex(  -0.2	,-1.4	,0.1);	vertex(-0.0	,-1.6	,0.0);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    
    
    vertex(  -0.0	,0.1	,0.2);	vertex(-0.4	,0.1	,0.2);
    vertex(  -0.4	,0.1	,0.2);	vertex(-0.6	,0.5	,0.1);
    vertex(  -0.6	,0.5	,0.1);	vertex(-0.0	,0.4	,0.2);
    vertex(  -0.0	,0.4	,0.2);	vertex(-0.3	,0.1	,0.2);
    endShape();
    
     // \ ****************************************************** 
     
     beginShape(LINES);
    
    
    endShape();
    popMatrix();
    popMatrix();
    postop();
    if(collision>0)collision--;
    }
    
    //draw
    
    
    }//class
    
    class missl extends mover{
      float thur =0.0;  
      int life = 0;
      boolean first=false;
      missl(hydroplane thing){
        xp = 0.0+thing.xp+thing.xv*0.1;
        yp = 0.0+thing.yp+thing.yv*0.1;
        zr = 0.0+thing.zr;
        mv =1.0+thing.mv;
    
      }
    
      void refire(hydroplane thing){
    //    if(thing.mv>0.0){
        xp = 0.0+thing.xp+cos(thing.theta);
        yp = 0.0+thing.yp+sin(thing.theta);
    //    }
        zr = 0.0+thing.zr;
        mv =1.5+max(thing.mv,0.0);
        thur =random(PI)+1.0;
        life =42;
    
      }
    
      void draw(){
        if(life>0){
          life--;
          prequel();
    super.updateDraw();
          translate(0.,0.5+hydro.mv,-1.7);
          rotateZ(thur);
          // ****************************************************** 
          // ****************************************************** 
          // ****************************************************** 
          stroke(255,255,0);
          {
            beginShape(LINES);
    
            vertex(  0.0	,0.3	,0.0);	
            vertex(-0.1	,0.1	,0.0);
            vertex(  -0.1	,0.1	,0.0);	
            vertex(-0.3	,0.1	,0.0);
            vertex(  -0.3	,0.1	,0.0);	
            vertex(-0.1	,0.0	,0.0);
            vertex(  -0.1	,0.0	,0.0);	
            vertex(-0.1	,-0.3	,0.0);
            vertex(  -0.1	,-0.3	,0.0);	
            vertex(0.1	,-0.1	,0.0);
            vertex(  0.1	,-0.1	,0.0);	
            vertex(0.3	,-0.2	,0.0);
            vertex(  0.3	,-0.2	,0.0);	
            vertex(0.2	,0.0	,0.0);
            vertex(  0.2	,0.0	,0.0);	
            vertex(0.4	,0.2	,0.0);
            vertex(  0.4	,0.2	,0.0);	
            vertex(0.1	,0.1	,0.0);
            vertex(  0.1	,0.1	,0.0);	
            vertex(0.1	,0.4	,0.0);
            vertex(  0.1	,0.4	,0.0);	
            vertex(0.0	,0.3	,0.0);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  0.1	,0.4	,0.0);	
            vertex(0.1	,0.4	,0.1);
            vertex(  0.1	,0.4	,0.1);	
            vertex(0.1	,0.1	,0.1);
            vertex(  0.1	,0.1	,0.1);	
            vertex(0.4	,0.2	,0.1);
            vertex(  0.4	,0.2	,0.1);	
            vertex(0.2	,0.0	,0.1);
            vertex(  0.2	,0.0	,0.1);	
            vertex(0.3	,-0.2	,0.1);
            vertex(  0.3	,-0.2	,0.1);	
            vertex(0.1	,-0.1	,0.1);
            vertex(  0.1	,-0.1	,0.1);	
            vertex(-0.1	,-0.3	,0.1);
            vertex(  -0.1	,-0.3	,0.1);	
            vertex(-0.1	,0.0	,0.1);
            vertex(  -0.1	,0.0	,0.1);	
            vertex(-0.3	,0.1	,0.1);
            vertex(  -0.3	,0.1	,0.1);	
            vertex(-0.1	,0.1	,0.1);
            vertex(  -0.1	,0.1	,0.1);	
            vertex(0.0	,0.3	,0.1);
            vertex(  0.0	,0.3	,0.1);	
            vertex(0.1	,0.4	,0.1);
            vertex(  0.1	,0.4	,0.1);	
            vertex(0.1	,0.4	,0.0);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  0.1	,0.1	,0.0);	
            vertex(0.1	,0.1	,0.1);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  0.2	,0.0	,0.1);	
            vertex(0.2	,0.0	,0.0);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  0.3	,-0.2	,0.0);	
            vertex(0.3	,-0.2	,0.1);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  -0.1	,-0.3	,0.1);	
            vertex(-0.1	,-0.3	,0.0);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  -0.1	,0.0	,0.0);	
            vertex(-0.1	,0.0	,0.1);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  -0.3	,0.1	,0.1);	
            vertex(-0.3	,0.1	,0.0);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  -0.1	,0.1	,0.0);	
            vertex(-0.1	,0.1	,0.1);
            endShape();
    
            // \ ****************************************************** 
    
            beginShape(LINES);
    
    
            vertex(  0.4	,0.2	,0.1);	
            vertex(0.4	,0.2	,0.0);
            endShape();
    
            // \ *****************
            //MIRROR  
            //************************************* 
    
            beginShape(LINES);
    
            endShape();
          }
    
    
    
          postop(); 
        }
      }
    
    
      boolean collide(mover target){
        boolean result=false;
        if(life>0 && !target.exploding){
          xp -= xv;    
          yp -= yv; 
          result = result || super.collide(target);
          xp += xv/4.0; 
          yp += yv/4.0;
          result = result || super.collide(target);
          xp += xv/4.0; 
          yp += yv/4.0;
          result = result || super.collide(target);
          xp += xv/4.0; 
          yp += yv/4.0;
          result = result || super.collide(target);
          xp += xv/4.0; 
          yp += yv/4.0;
          result = result || super.collide(target);
          //   xp -= xv; yp -= yv;
          if(result && !target.exploding){life=0;}
        }
        return result;
      }
    
    }//class
    
    class wake extends missl{
      float spd =0.0;
      PVector real1 = new PVector(0.0,0.0,0.0);
      PVector real2 = new PVector(0.0,0.0,0.0);
      wake(hydroplane thing){
        super(thing);
    
      }
    
      
      void refire(hydroplane thing){
        xp = 0.0+thing.xp+thing.xv*0.3;
        yp = 0.0+thing.yp+thing.yv*0.3;
        
        zv = 0.45*thing.mv;
        zp = thing.zp;//+0.5 ;
        zr = 0.0+thing.zr;
        mv =0.0;
        thur =0.0;
    //    ctr =0;
        life =((min(42,(int)(thing.mv*15.0))));
        spd=thing.mv/5.0;
    //        first=true;
      }
    
      void draw(){
        if(life>0){
          life--;
          thur += spd;
          prequel();
          pushMatrix();
          if(first){
            super.draw();
            first=false;
          }else{
          super.updateDraw();
          }
    //            translate(0.,0.0,-2.1);
    pushMatrix();
          translate(0.,0.5+hydro.mv,-1.6);
          scale(1,1,0.1);
          //        rotateZ(thur);
          
          if(zp>waves/2){
          zv -= (0.1);
          }else{
            zv /=4.0;
           zv +=0.1; 
          }
          zv /= 1.1;
    
          ;;;
          // ****************************************************** 
          // ****************************************************** 
          // ****************************************************** 
          stroke(50+(float)life*7,50+(float)life*8,200); 
          beginShape(LINES);
    vertex(-0.1,0.0,-zp*10);
          vertex(  -0.05	,0.0	,0.0);	
          vertex(0.05	,0.0	,0.0);
          vertex(0.1,0.0,-zp*10);
          //vertex(  0.4	,0.0	,0.1);	vertex(0.8	,0.0	,0.0);
          endShape();
    if(last1.y==0.0){
        last1.x = modelX(0.2,0,0);
            last1.y = modelY(0.2,0,0);
                last1.z = modelZ(0.2,0,0);
                    last2.x = modelX(-0.2,0,0);
            last2.y = modelY(-0.2,0,0);
                last2.z = modelZ(-0.2,0,0);
    }
    //      line(((40)-(float)life+(mv/20.0+0.5))/(9.0),0,0,0+((40)-(float)life)/7.0,0,0);
    //      line(((40)-(float)life+(mv/20.0+0.5))/(-9.0),0,0,0+((40)-(float)life)/(-7.0),0,0);
        line(thur+0.2,0,0,thur+0.5,0,0); 
        line(thur+0.1,0,-zp*10,thur+0.2,0,0);
        line(thur+0.6,0,-zp*10,thur+0.5,0,0);
    //    real1.x = modelX(thur+0.2,0,0);
    //        real1.y = modelY(thur+0.2,0,0);
    //            real1.z = modelZ(thur+0.2,0,0);
    //    line(lastw.x,lastw.y,lastw.z,thur+0.2,0,0);
        line(-thur-0.2,0,0,-thur-0.5,0,0);
        line(-thur-0.1,0,-zp*10,-thur-0.2,0,0);
        line(-thur-0.6,0,-zp*10,-thur-0.5,0,0);
    //        real2.x = modelX(-thur-0.2,0,0);
    //        real2.y = modelY(-thur-0.2,0,0);
    //            real2.z = modelZ(-thur-0.2,0,0);
    //    line(lastw.x,lastw.y,lastw.z,-thur-0.2,0,0);
          postop();
          pushMatrix();
    //      resetMatrix();
    //      translate(cam.x,cam.y,cam.z);
    //  translate(-width/2,-height/2,-25);
    //      line(last1.x,last1.y,last1.z,real1.x,real1.y,real1.z);      
    //      line(last1.x,last1.y,0,real1.x,real1.y,0);
    //            line(last1.x+0.3*50,last1.y+0.3*50,last1.z+0.3*50,real1.x+0.3*50,real1.y+0.3*50,real1.z+0.3);
    //            line(last2.x-0.3,last2.y-0.3,last2.z-0.3,real2.x-0.3,real2.y-0.3,real2.z-0.3);
    //                  line(last2.x,last2.y,last2.z,real2.x,real2.y,real2.z);
    //                        line(last1.x,last1.y,last1.z,real2.x,real2.y,real2.z);
    //                        line(last2.x,last2.y,last2.z,real1.x,real1.y,real1.z);      
    //                                    line(last2.x,last2.y,0,real2.x,real2.y,0);
          popMatrix();
          last1.x = real1.x;      last1.y = real1.y;      last1.z = real1.z;
          last2.x = real2.x;      last2.y = real2.y;      last2.z = real2.z;
          popMatrix();
          popMatrix();
        }
      }
      
     
    }//class
    
    
    class mover{
      float xp=0.0, yp=0.0, zp=0.0;//position
      float xv=0.0, yv=0.0, zv=0.0;//velocity
      float xr=0.0, yr=0.0, zr=0.0;//rotation
      float xrv=0.0,yrv=0.0,zrv=0.0;//rot velocity
      float mv=0.0; //main velocity
      float waves = 0.0;
      float wavept =0.0;
      float theta=0.0;
      boolean exploding=false;
      mover(){
       ; 
      }
      
      void updatePos(){
       xp = xp + xv;
      yp = yp + yv;
     zp = zp + zv; 
      }
    void   updateRot(){
           xr = xr + xrv;
      yr = yr + yrv;
     zr = zr + zrv; 
      }
      
    void  updateVelMV_Z(){
      theta=zr-radians(90);
      xv = cos(theta)*mv;
     yv = sin(theta)*mv; 
      }
      
      void draw(){
        translate(xp+cam.x,yp+cam.y,zp+cam.z);
        calcyThing();
        rotateX(xr);rotateY(yr);rotateZ(zr);
      }
        void updateDraw(){
          updateRot();updateVelMV_Z();updatePos();
          calcyThing();
    //      wavept = sin(((9.0*xp+(yp/100.0))/33.0-((wavy*3.0)%TWO_PI))%TWO_PI) + sin(((6.0*yp-(xp/70.0))/45.9-((wavy+3)*3.0)%TWO_PI)%TWO_PI);
    //      waves = (waves*3.0+((wavept))/2.0)/4.0;
        translate(xp+cam.x,yp+cam.y,zp+cam.z+waves/2.0);
        rotateX(xr);rotateY(yr);rotateZ(zr);
      }
      
      void calcyThing(){
       wavept = sin((xp/2.0+yp/4.0+wavy)%TWO_PI)  + cos(((yp/2.0-xp/12.0)-wavy)%TWO_PI);
       waves = (waves*6.0+wavept) / 7.0;
       
      }
      
        float calcyThing(float tx, float ty){
          float result=0.0,rept=0.0;
       rept = sin((tx/2.0+ty/4.0+wavy)%TWO_PI)  + cos(((ty/2.0-tx/12.0)-wavy)%TWO_PI);
       result = (waves*2.0+rept) / 3.0;
       return result;
      }
          float calcyThing2(float tx, float ty){
          float result=0.0,rept=0.0;
       rept = sin(((xp+tx)/2.0+(yp+ty)/4.0+wavy)%TWO_PI)  + cos((((yp+ty)/2.0-tx/12.0)-wavy)%TWO_PI);
    //   result = (waves*2.0+rept) / 3.0;
       return rept;
      }
      
      void prequel(){
         pushMatrix();
      translate(width/2,height/2,0);
      
      scale(50.0,50.0,50.0);
    // translate(cam.x,cam.y,cam.z);
      rotateX(radians(60)); 
      }
      
      void postop(){
       popMatrix(); 
      }
      
      boolean collide(mover target){
       if(abs(xp-target.xp)<1.0 &&(abs(yp-target.yp)<1.0)){
        return true;
       }else{
        return false;
       } 
        
      }
    //  float getWave(){
    //      wavept = sin(((2.0*xp+(yp/100.0))/23.0-((wavy/3.0)%TWO_PI))%TWO_PI) + sin(((3.0*yp-(xp/100.0))/25.9-((wavy+3)/9.1)%TWO_PI)%TWO_PI);
    //        waves = (waves*8.0+cos((wavept*TWO_PI*2.0)%TWO_PI)/2.0)/9.0;
    //        return waves;
    //}
    
    void explode(){
     ;//do explosion stuff 
    }
    }//class
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Chris Ball

    Hydroplane Game Beta 0.02

    Add to Faves Me Likey@! 2
    You must login/register to add this sketch to your favorites.

    use arrow keys to drive the boat, space to fire

    Supposed to be a hydroplane minesweeping an oilfield

    Chris Ball
    6 Nov 2010
    oops, trigger sticky
    oops, infinite speed impossible
    oops, needs radar
    dotlassie
    5 Dec 2010
    Your water is quite awesome looking!
    It would be great to make it First Person Perspective;) See my simmilar 3D game: http://www.openprocessing.org/sketch/83315
    You need to login/register to comment.