top of page

DEBUT CODE 2

int a;
int b;
int c;

void setup(){
  c=0;
  d=0;
  e=0;
}


void drew() {
  if(c<60){
    c=c+2;
    
  }
  else{
    c=0;
    d=d+1;}
    if(d>=60){
      d=0;
      e=e+1;
    }
    if(e==5){
      text("time out", 200, 200);
    }}

CHRONO

void Chrono(){
  fill(150);
if(c<100){
    c=c+2;
    
  }
  else{
    c=0;
    d=d+1;}
    if(d>=60){
      d=0;
      e=e+1;
    }
    if(e==5){
      textSize(70);
      text("End", 200, 200);
    }
    
  text("  : "+ c, 100, 10);
  text(" : "+ d, 83, 10);
  text("Time: "+ e, 40, 10);

}

FOND

void fond(){
 background(img);
}

PERSONNAGE

void personnage(){
  noStroke();
  rect(a,b,30,30);
  image(img2,a,b);
}

DEPLACEMENT

void deplacement(){
 if(keyPressed){
    if(key== CODED){
      if(keyCode == UP){
        if (red(get(a,b-1))==0){
          b=b;
        }
        else{
          b=b-1;
          }
        }
      }
    }
 
    if(keyPressed){
    if(key== CODED){
      if(keyCode == LEFT){
       if (red(get(a-1,b))==0){
          a=a;
        }
        else{
          a=a-1;
          }
        }
      }
   }
 if (keyPressed) {
    if (key == CODED) {
      if (keyCode == RIGHT) {
        if (red(get(a+35, b))==0) {
          a=a;
        } else {
          a = a+1;
        }
      }
    }
  }
  if (keyPressed) {
    if (key == CODED) {
      if (keyCode == DOWN) {
        if (red(get(a, b+35))==0) {
          b=b;
        } else {
          b = b+1;
        }
      }
    }
  }
  };

bottom of page