• fullscreen
  • Conf.pde
  • Laser.pde
  • MotherShip.pde
  • Protection.pde
  • Ship.pde
  • SpaceInvader.pde
  • Space_Invader_finish.pde
  • class Conf
    {
      boolean flag;
      boolean game;
      boolean fpY;
      boolean Ri,Le,Ti;
      boolean senss;
      boolean jeu;
      boolean shiptouche;
      boolean shiptoucheLaser;
    
      float sense;
    
      int deltaX;
      int deltaY;
      int vie;
      int score;
      int fcount;
      int[] konami = new int[10];
      int[] konamicode = {1,1,2,2,3,4,3,4,6,5};
    
      PImage filtre; 
      PFont fontA;
    
    
      Conf()
      {
        deltaX=width/10+35;
        deltaY=height/10+50;
        flag=true;
        fpY=false;
        game=true;
        Ri=false;
        Le=false;
        Ti=false;
        senss=false;
        jeu=false;
        shiptouche=false;
        shiptoucheLaser=false;
        vie=3;
        sense=5;
        fcount=30;
        score=0;
        filtre = loadImage("filtrejeu.tga");
        fontA = loadFont("CourierNew36.vlw");
      }
    
    
    }
    
    
    
    
    /**  Clone de Space Invader **/
    /**  Programmation Tristan Brismontier **/
    
    class Laser
    {
      float pX;
      float pY;
      float taille;
      boolean tire;
      float speedy;
      int type;
      boolean unedeux=true;
    
      Laser(float x_, float y_)
      {
        pX=x_;
        pY=y_;
        taille = 3;
        tire=false;
        speedy=-2.5;  
        type = 2;
      }
    
      Laser()
      {
        pX=width/2;
        pY=9*height/10;
        taille = 2;  
        tire=false;  
        speedy=4.1;
        type = 1;
      }
    
      void display()
      {
        if(tire==true)
        {
          if(type==1)
          {
            strokeWeight(taille);
            stroke(255);
            line(pX,pY,pX,pY-5*taille); 
          }
          else
          {
            strokeWeight(taille-1);
            stroke(255);
            line(pX+taille,pY,pX-taille,pY-taille); 
            line(pX-taille,pY-taille,pX+taille,pY-2*taille); 
            line(pX+taille,pY-2*taille,pX-taille,pY-3*taille); 
            line(pX-taille,pY-3*taille,pX+taille,pY-4*taille);
           line(pX+taille,pY-4*taille,pX-taille,pY-5*taille);  
          }
        }
      }
    
      void move()
      {
        if(tire==true)
        {
          pY=pY - speedy; 
          if( pY < 0 || pY > height+5*taille )
          {
            pX=0;
            pY=0;
            tire=false;
          }
        }
      }
    
      void lancement(float x_)
      {
        if(tire==false)
        {
          tire=true;
          pX=x_;
          if(unedeux==true)
          {
             pY=9*height/10;
             unedeux=!unedeux;
          }
          else
          {
            pY=9*height/10-2;
            unedeux=!unedeux;
          }
          
        }
      }  
    
      void lancement(float x_,float y_)
      {
        if(tire==false)
        {
          tire=true;
          pX=x_;
          pY=y_;
          
         
        } 
    
      }
    }
    
    
    
    
    
    class MotherShip
    {
    
      float spX;
      float spY;
      int taillex;
      int tailley;
      float speedx;
      boolean existe;
      boolean sens;
    
    
      MotherShip()
      {
        spX=width/2;
        spY=65;
    
        existe=false;
    
        speedx = 1;
    
        taillex = 2;
        tailley = 2;
      }
    
    
    
      void display()
      {
        if(existe==true)
        {
          
          noStroke();  
          fill(255,10,10);
          rectMode(CORNER);
          rect(-3*taillex+spX,-3*tailley+spY,6*taillex,tailley);
          rect(-5*taillex+spX,-2*tailley+spY,10*taillex,tailley);
          rect(-6*taillex+spX,-1*tailley+spY,12*taillex,tailley);
          rect(-7*taillex+spX,0*tailley+spY,2*taillex,tailley);
          rect(-4*taillex+spX,0*tailley+spY,2*taillex,tailley);
          rect(-1*taillex+spX,0*tailley+spY,2*taillex,tailley);
          rect(2*taillex+spX,0*tailley+spY,2*taillex,tailley);
          rect(5*taillex+spX,0*tailley+spY,2*taillex,tailley);
          rect(-8*taillex+spX,1*tailley+spY,16*taillex,tailley);
          rect(-6*taillex+spX,2*tailley+spY,3*taillex,tailley);
          rect(-1*taillex+spX,2*tailley+spY,2*taillex,tailley);
          rect(3*taillex+spX,2*tailley+spY,3*taillex,tailley);
          rect(-5*taillex+spX,3*tailley+spY,1*taillex,tailley);
          rect(4*taillex+spX,3*tailley+spY,1*taillex,tailley);
    
        }
      }
    
      void lancement(float k)
      {
        if( k < 1 )
        {
          
          spX=-7*taillex;
          sens = true;
        }
        else
        {
          spX=width+7*taillex;
          sens=false;
        }
        speedx=random(0.8,2);
        existe=true;
      }
      
      
      void move()
      {
        if(spX +8*taillex > 0 && spX - 8*taillex < width)
        {
          if( sens == true ) 
          {
             spX = spX + speedx;
          }
          else
          {
            
            spX = spX -speedx;
          }
        }
        else
        {
          existe=false;
        }
      }
    
      boolean contact(float x_, float y_)
      {
        if(existe==true)
        {
          if(x_ < spX +8*taillex && x_ > spX - 8*taillex && y_> -3*tailley+spY && y_ < 3*tailley+spY)
          {
            existe=false;
    
          } 
          return existe;
        }
        else
        {
          return true;
        }
      }
    }
    
    
    
    class Protection
    {
      int x,y;
      int taillex,tailley;
      int[][]  protect = {
                  {0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0},
                  {0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0},
                  {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1},
                  {1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1},
                  {1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1},
                  {1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1}
                };
                
       Protection(int x_, int y_)
      {
        x = x_;
        y = y_;
        
        taillex=2;
        tailley=2;
      }   
      
      void display()
      {
        
        noStroke();
        fill(0,255,0);
        rectMode(CENTER);
        for(int i =0; i<15;i++)
        {
          for(int j=0; j<20;j++)
          {
            if(protect[i][j]==1)
            {
              rect(j*taillex+x,i*tailley+y,taillex,tailley);
            }
          }
        }
      }
      
      boolean contact(float pX, float pY)
      {
        boolean flagtouch =false;
        for(int i =0; i<15;i++)
        {
          for(int j=0; j<20;j++)
          {
            if(pX >= j*taillex+x-taillex/2 && pX <= j*taillex+x+tailley/2 && pY >= i*tailley+y-tailley/2 && pY <= i*tailley+y+tailley/2 && protect[i][j]==1)
            {
              protect[i][j]=0;
              for(int t=i-2;t<=i+2;t++)
              {
                for(int r = j-2; r<=j+2;r++)
                {
                  if( t>=0 && t <15 && r>=0 && r < 20)
                  {
                    if(random(100)>75)
                    {
                      protect[t][r]=0;
                    }
                  }
                }
              }
              flagtouch = true;
            }
          }
        }
        return flagtouch;
      }
      
      
    }
    
    /**  Clone de Space Invader **/
    /**  Programmation Tristan Brismontier **/
    
    class Ship
    {
      float spX;
      float spY;
      int taille;
    
      Ship(float x_, float y_)
      {
        spX=x_;
        spY=y_;
        taille=2;
      }
      Ship()
      {
        spX=width/2;
        spY=9*height/10;
        taille=2;
      }
    
      void display()
      {
        noStroke();
        fill(0,255,0);
        rectMode(CENTER);
        rect(spX,spY,15*taille,7*taille); 
        rect(spX,spY-5*taille,3*taille,3*taille);
        rect(spX,spY-7*taille,taille,taille);
        fill(0);
        rect(spX-7*taille,spY-3*taille,taille,taille);
        rect(spX+7*taille,spY-3*taille,taille,taille);
      }
    
      boolean contact(float x_, float y_)
      {
        if(x_ >spX-7*taille && x_ < spX+7*taille && y_ > spY-15*taille && y_<spY+taille )
        {
          return true;
        }
        else
        {
          return false;
        } 
      }
    
      void move(float sens)
      {
        float spXt =spX+sens;
    
        if( spXt > 14*width/15 )
        {  
        }
        else
        {
          if( spXt< width/15 )
          {
          }
          else
          {
            spX = spX +sens;
          }
        }
      }
    
    }
    
    
    
    
    
    
    /**  Clone de Space Invader **/
    /**  Programmation Tristan Brismontier **/
    
    class SpaceInvader
    {
      int type;
      float spX;
      float spY;
      int taillex;
      int tailley;
      float speedx;
      int speedy;
      boolean existe;
      boolean fspY=false;
    
      SpaceInvader()
      {
        spX=width/2;
        spY=height/2;
    
        existe=true;
    
        speedy = 1;
        speedx = 5;
    
        taillex = 2;
        tailley = 2;
      }
    
      SpaceInvader(int X_, int Y_, int _type)
      {
        type=_type;
        spX=X_;
        spY=Y_;
    
        existe=true;
    
        speedy = 1;
        speedx =5;
    
        taillex = 2;
        tailley = 2;
    
      }
    
      void display(boolean flag)
      {
        if(existe==true)
        {
          if(type==1)
          {
            
            noStroke();  
            fill(255);
            rectMode(CORNER);
            rect(-2*taillex+spX,-4*tailley+spY,4*taillex,tailley);   
            rect(-5*taillex+spX,-3*tailley+spY,10*taillex,tailley);    
            rect(-6*taillex+spX,-2*tailley+spY,12*taillex,tailley); 
            rect(-6*taillex+spX,-1*tailley+spY,3*taillex,tailley);  
            rect(-1*taillex+spX,-1*tailley+spY,2*taillex,tailley);
            rect(3*taillex+spX,-1*tailley+spY,3*taillex,tailley);
            rect(-6*taillex+spX,spY,12*taillex,tailley);
            rect(1*taillex+spX,1*tailley+spY,2*taillex,tailley);
            rect(-3*taillex+spX,1*tailley+spY,2*taillex,tailley);
            rect(-1*taillex+spX,2*tailley+spY,2*taillex,tailley);
    
            if( flag==false)
            {
              rect(-4*taillex+spX,2*tailley+spY,2*taillex,tailley);
              rect(2*taillex+spX,2*tailley+spY,2*taillex,tailley);
              rect(-6*taillex+spX,3*tailley+spY,2*taillex,tailley);
              rect(4*taillex+spX,3*tailley+spY,2*taillex,tailley);
            }
            else
            {
              rect(-5*taillex+spX,2*tailley+spY,2*taillex,tailley);
              rect(3*taillex+spX,2*tailley+spY,2*taillex,tailley);
              rect(-4*taillex+spX,3*tailley+spY,2*taillex,tailley);
              rect(2*taillex+spX,3*tailley+spY,2*taillex,tailley);
            }
    
          }
          if(type==2)
          {
            noStroke();  
            fill(255);
            rectMode(CORNER);
            rect(-3.5*taillex+spX,-5.0*tailley+spY,1*taillex,1*tailley);
            rect(2.5*taillex+spX,-5.0*tailley+spY,1*taillex,1*tailley);
            rect(-2.5*taillex+spX,-4.0*tailley+spY,1*taillex,1*tailley);
            rect(1.5*taillex+spX,-4.0*tailley+spY,1*taillex,1*tailley);
            rect(-3.5*taillex+spX,-3.0*tailley+spY,7*taillex,1*tailley);
            rect(-3.5*taillex+spX,-3.0*tailley+spY,1*taillex,5*tailley);
            rect(2.5*taillex+spX,-3.0*tailley+spY,1*taillex,5*tailley);
            rect(-3.5*taillex+spX,-1.0*tailley+spY,7*taillex,2*tailley);
            rect(-1.5*taillex+spX,-2.0*tailley+spY,3*taillex,1*tailley);
            rect(-4.5*taillex+spX,-2.0*tailley+spY,1*taillex,2*tailley);
            rect(3.5*taillex+spX,-2.0*tailley+spY,1*taillex,2*tailley);
            if( flag==false)
            {
              rect(-5.5*taillex+spX,-1.0*tailley+spY,1*taillex,3*tailley);
              rect(4.5*taillex+spX,-1.0*tailley+spY,1*taillex,3*tailley);
              rect(.5*taillex+spX,2.0*tailley+spY,2*taillex,1*tailley);
              rect(-2.5*taillex+spX,2.0*tailley+spY,2*taillex,1*tailley);
            }
            else
            {
              rect(-5.5*taillex+spX,-4.0*tailley+spY,1*taillex,3*tailley);
              rect(4.5*taillex+spX,-4.0*tailley+spY,1*taillex,3*tailley);
              rect(3.5*taillex+spX,2.0*tailley+spY,1*taillex,1*tailley);
              rect(-4.5*taillex+spX,2.0*tailley+spY,1*taillex,1*tailley);
            }
          }
          if(type==3)
          {
            noStroke();  
            fill(255);
            rectMode(CORNER);
            rect(-1*taillex+spX,-3*tailley+spY,2*taillex,tailley);
            rect(-2*taillex+spX,-2*tailley+spY,4*taillex,tailley);
            rect(-3*taillex+spX,-1*tailley+spY,6*taillex,tailley);
            rect(-4*taillex+spX,spY,2*taillex,tailley);
            rect(-1*taillex+spX,spY,2*taillex,tailley);
            rect(2*taillex+spX,spY,2*taillex,tailley);
            rect(-4*taillex+spX,1*tailley+spY,8*taillex,tailley);
            rect(-2*taillex+spX,2*tailley+spY,taillex,tailley);
            rect(taillex+spX,2*tailley+spY,taillex,tailley);
            rect(-3*taillex+spX,3*tailley+spY,taillex,tailley);
            rect(2*taillex+spX,3*tailley+spY,taillex,tailley);
            rect(-2*taillex+spX,4*tailley+spY,taillex,tailley);
            rect(taillex+spX,4*tailley+spY,taillex,tailley);
            rect(-2*taillex+spX,4*tailley+spY,taillex,tailley);
            rect(taillex+spX,4*tailley+spY,taillex,tailley);
    
            if( flag==false)
            {
              rect(-4*taillex+spX,4*tailley+spY,taillex,tailley);
              rect(3*taillex+spX,4*tailley+spY,taillex,tailley);
              rect(-1*taillex+spX,3*tailley+spY,2*taillex,tailley);
            }
    
          }
        }
      }
    
      boolean move(float signe, boolean fpY)
      {
    
        if(fpY!=fspY)
        {
          spY = spY + 10;
          fspY=fpY;
          return false;    
        }
        else
        {
          //float speedxt = speedx * signe;
          spX = spX + signe;
          if(existe==true)
          {
            if( spX > 14*width/15 )
            {      
              return true;
            }
            else
            {
              if( spX < width/15 )
              {
                return true;
              } 
              else
              {
                return false;
              } 
            }
          }
          else
          {
            return false;
          }
        } 
      }
    
      boolean contact(float x_, float y_)
      {
        if(existe==true)
        {
          if(x_ < 4.5*taillex+spX+taillex && x_ > -4.5*taillex+spX-taillex && y_>-5.0*tailley+spY && y_ < 2.0*tailley+spY)
          {
            existe=false;
    
          } 
          return existe;
        }
        else
        {
          return true;
        }
      }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    /**  Clone de Space Invader **/
    /**  Programmation Tristan Brismontier **/
    
    
    int rows = 5;
    int cols = 10;
    SpaceInvader[][] spaceInv = new SpaceInvader[cols][rows];
    Protection[] protec = new Protection[4];
    Laser[] laserEn = new Laser[3];
    Ship[] shipVie = new Ship[3];
    MotherShip motherShip;
    Laser lazer;
    Conf conf;
    Ship ship;
    
    
    
    void setup()
    {  
      size(501,432);
      background(255);
      frameRate(60);
      conf = new Conf();
      ship = new Ship();
      lazer = new Laser();
      motherShip = new MotherShip();
    
      for(int i=0;i<shipVie.length;i++)
      {
        shipVie[i] = new Ship(width-120+40*i,height/15);   
        laserEn[i] = new Laser(0,0);   
      }
      for(int i=0;i<protec.length;i++)
      {
        protec[i] = new Protection(i*125+45,310); 
      }
      // Création et placement des space Invader
    
      for(int i=0;i<cols;i++)
      {
        for(int j=0;j<rows;j++)
        {
          if(j==0)
          {
            spaceInv[i][j] = new SpaceInvader(conf.deltaX+35*i,conf.deltaY+30*j,3); 
          }  
          else
          {  
            if(j==1 || j==2)
            {
              spaceInv[i][j] = new SpaceInvader(conf.deltaX+35*i,conf.deltaY+30*j,2);
            }
            else
            {
              spaceInv[i][j] = new SpaceInvader(conf.deltaX+35*i,conf.deltaY+30*j,1);
            }
          }
        }
      }
    
    }
    
    
    
    /**************  Commencement *************/
    
    
    
    void draw()
    {
      afficheScore();
    
      if(conf.game==true)
      {
        initVar();
    
    
        lazer.display();
        ship.display();
        lazer.move();
    
        actionShip();
    
        // Gestion du MotherShip
        motherShip.display();
        motherShip.move();
        if(motherShip.contact(lazer.pX,lazer.pY)==false)
        {
          conf.score += int(random(40,250));
          lazer.tire=false;
          lazer.pY=height; 
        }
        if(random(100) > 99.7)
        {
    
          if(motherShip.existe == false)
          {   
            float k = random(0,2);
            motherShip.lancement(k);
          }
        }
        // fini avec le Mothership
    
        for(int i=0;i<protec.length;i++)
        {
          protec[i].display();
    
        }
    
    
        if(frameCount % conf.fcount == 0 )
        {
    
          conf.flag = !conf.flag;
          for(int i=0;i<cols;i++)
          {
    
            for(int j=0;j<rows;j++)
            {
    
              if(spaceInv[i][j].move(conf.sense, conf.fpY) == true)
              {
                conf.senss=true; 
              }
    
            }
          }
        }
    
        for(int i=0;i<cols;i++)
        {
    
          if(i<3)
          {
            laserEn[i].move();
            laserEn[i].display();
            if(ship.contact(laserEn[i].pX,laserEn[i].pY) == true)
            {
              conf.shiptoucheLaser=true;
              laserEn[i] = new Laser(0,0);
            }
            for(int k=0; k < protec.length;k++)
            {
              if(protec[k].contact(laserEn[i].pX,laserEn[i].pY)== true)
              {
                protec[k].contact(laserEn[i].pX,laserEn[i].pY+2);
                laserEn[i] = new Laser(0,0);
              }
              if(protec[k].contact(lazer.pX,lazer.pY)== true)
              {
                lazer.tire=false;
                lazer.pY=height;
              }
            }
          }
    
          if(i<conf.vie)
          {
            shipVie[i].display();
          }
    
          for(int j=0;j<rows;j++)
          {
    
            for(int k=0; k < protec.length;k++)
            {
              for(int p =0; p<15;p++)
              {
                for(int o=0; o<20;o++)
                {
                  if(spaceInv[i][j].existe == true)
                  {
                    if(protec[k].protect[p][o]==1)
                    {
                      if(o*protec[k].taillex+protec[k].x >spaceInv[i][j].spX-4*spaceInv[i][j].taillex && o*protec[k].taillex+protec[k].x < spaceInv[i][j].spX+4*spaceInv[i][j].taillex && p*protec[k].tailley+protec[k].y < spaceInv[i][j].spY+4*spaceInv[i][j].tailley)
                      {
                        protec[k].protect[p][o]=0;
                      } 
                    }
                  }
                }  
              }      
            }
    
    
    
            if(spaceInv[i][j].contact(lazer.pX,lazer.pY)==false)
            {
              switch (spaceInv[i][j].type)
              {
              case 1: 
                conf.score += 10; 
                break;
              case 2: 
                conf.score += 20; 
                break;
              case 3: 
                conf.score += 40; 
                break;
              }
              lazer.tire=false;
              lazer.pY=height;
            }
    
            if(spaceInv[i][j].existe==true)
            { 
              if(random(100) > 99.98)
              {
                int k = int(random(0,3));
                if(laserEn[k].tire == false)
                {
                  laserEn[k].lancement(spaceInv[i][j].spX,spaceInv[i][j].spY);
                }
              }
              if(ship.contact(spaceInv[i][j].spX,spaceInv[i][j].spY)==true ||  spaceInv[i][j].spY>=9*height/10)
              {
                conf.shiptouche=true;
              }
              conf.jeu=true;
            }
    
            spaceInv[i][j].display(conf.flag);
    
          }
        }
    
    
        changementDeSens();
    
        shipTouche();
    
        if(conf.jeu==false || conf.shiptouche==true)
        {
          if(conf.shiptouche==true)conf.vie-=1;
          if(conf.vie<0)conf.game=false;
          for(int i=0;i<cols;i++)
          {
            for(int j=0;j<rows;j++)
            {
              init(i,j);
            }
          }
        }
      }
      else
      {
        jeuFini();
      }
      // Affichage du filtre style allow Arcade 
      image(conf.filtre, 0, 0);
    }
    
    
    /***  Gestion des Touches ***/
    
    
    void keyPressed()
    {
      konamiFonc();
      
      if(keyCode==RIGHT)
      {
        conf.Ri=true;
      }
      if(keyCode==LEFT)
      {
        conf.Le=true;
      }
      if(key==' ')
      {
        conf.Ti=true;
      }
    }
    
    void keyReleased()
    {
      if(keyCode==RIGHT)
      {
        conf.Ri=false;
      }
      if(keyCode==LEFT)
      {
        conf.Le=false;
      }
      if(key==' ')
      {
        conf.Ti=false;
      }
    }
    
    /*** Les Actions du ship ***/
    
    void actionShip()
    {
      if(conf.Ri==true)
      {
        ship.move(3);
      }
      if(conf.Le==true)
      {
        ship.move(-3);
      }
      if(conf.Ti==true)
      {
        lazer.lancement(ship.spX);
      }
    }
    
    
    /***  Initialistaion  de Variable de Draw()  ***/
    
    void initVar()
    {
      conf.senss=false;
      conf.jeu=false;
      conf.shiptouche=false;
      conf.shiptoucheLaser=false;
    }
    
    
    /***  Initialisation des Invader  ***/
    
    
    void init(int i,int j)
    {
      spaceInv[i][j].spX=conf.deltaX+35*i;
      spaceInv[i][j].spY=conf.deltaY+30*j;
      spaceInv[i][j].existe=true;
      conf.sense=5;
      conf.fcount=40;
    }
    
    
    
    /*****  Affichage du score / Terre  / background  ******/
    
    
    void afficheScore ()
    {
      background(0);
      textFont(conf.fontA, 15);
      textAlign(LEFT);
      text("Score: ",width/20,height/15);
      text(int(conf.score),width/20+60,height/15);
      strokeWeight(2);
      stroke(0,255,0);
      line(0,9*height/10+20,width,9*height/10+20);
    }
    
    
    /*** Quand t'a perdu ca fait ca ***/
    
    void jeuFini()
    {
      textFont(conf.fontA, 35);
      textAlign(CENTER);
      text("GAME OVER",width/2,height/2);
      if(mousePressed)
      {
        for(int i=0;i<protec.length;i++)
        {
          protec[i] = new Protection(i*125+45,310); 
        }
        conf.score=0;
        conf.vie=3;
        conf.game=true;
        for(int i=0;i<cols;i++)
        {
          for(int j=0;j<rows;j++)
          {
            init(i,j);
          }
        }
      }
    }
    
    /*** Changement de sense et accélération  ***/
    
    void changementDeSens()
    {
      if(conf.senss == true)
      {
        conf.fcount=conf.fcount-3;
        conf.fcount = constrain(conf.fcount,9,60);
        if(conf.sense>0)
        {
          conf.sense = conf.sense * -1 -0.3 ;
        }
        else
        {
          conf.sense = conf.sense * -1 + 0.3;
        }
        conf.sense=constrain(conf.sense,-12,12);
    
        conf.fpY=!conf.fpY;    
      }
    }
    
    /***  Le Ship  est Touche?? ***/
    
    void shipTouche()
    {
      if(conf.shiptoucheLaser==true)
      {
        conf.vie-=1;
        if(conf.vie<0)conf.game=false;
      }
    }
    
    
    /****  Konami  ***/
    
    void konamiFonc()
    {
      int vtemp=0;
      if(keyCode==UP)
      {
        vtemp=1;
      }
       if(keyCode==DOWN)
     {
       vtemp=2;
     }
      if(keyCode==LEFT)
     {
       vtemp=3;
     }
      if(keyCode==RIGHT)
     {
       vtemp=4;
     }
      if(key=='a' || key=='A')
     {
       vtemp=5;
     }
      if(key=='b' || key=='B')
     {
       vtemp=6;
     }
     for(int i=0;i<conf.konami.length-1;i++)
     {
       conf.konami[i] = conf.konami[i+1];
      
     }
    
     conf.konami[conf.konami.length-1] = vtemp;
      
     vtemp=10;
     for(int i=0;i<conf.konami.length;i++)
     {
       if(conf.konami[i] != conf.konamicode[i])
       {
         vtemp=9;
       }
       
     }
     if(vtemp == 10)
     {
       lazer.speedy=14;
       conf.vie=3;
       conf.fcount=50;
       println("konami");
     }
     
     
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    code

    tweaks (0)

    license

    advertisement

    Tristan Brismontier
    I had the Konami code
    very nice!!
    Check out the tweaks myself and another guy did for a school project!
    You need to login/register to comment.