Programme


import readBox.*;

import ddf.minim.*;

Minim minim;
AudioPlayer jingle;

PImage img;
PImage img1;

int x = 25;
int y = 650;

void setup() {

  minim = new Minim(this);
  jingle = minim.loadFile("Legend of Zelda - Ancient Hero.mp3");
  jingle.loop();

  img = loadImage("jiod.png");
  img1 = loadImage("labyrinthe3.png");

  image(img1, 0, 0);
  size(img1.width, img1.height);
  textSize(20);
}

void draw() {
  image(img1, 0, 0);
  // image(img2, 0, 0);
  // image(img3, 0, 0);

  bougerPerso();

  image(img, x, y, 50, 40);

  if (y == 25 && x>100) {
    fill (#057416);
    textSize(48);
    text("Porte ouverte", 940, 20);
  }
}


void bougerPerso() {
  if (keyPressed) {
    if (key == CODED) {
      if (keyCode == UP) {
        if (red(get(x, y-5))==0) {
          y=y;
        } else {
          y = y-1;
        }
      }
    }
  }
  if (keyPressed) {
    if (key == CODED) {
      if (keyCode == LEFT) {
        if (red(get(x-1, y))==0) {
          x=x;
        } else {
          x = x-1;
        }
      }
    }
  }
  if (keyPressed) {
    if (key == CODED) {
      if (keyCode == RIGHT) {
        if (red(get(x+47, y))==0) {
          x=x;
        } else {
          x = x+1;
        }
      }
    }
  }
  if (keyPressed) {
    if (key == CODED) {
      if (keyCode == DOWN) {
        if (red(get(x, y+43))==0) {
          y=y;
        } else {
          y = y+1;
        }
      }
    }
  }
}


Data :