1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| //variables des blocs possibles=======
PImage beton;
PImage paille;
PImage pierrebrise;
PImage bois;
PImage drapeau;
PImage pierre;
//Début programme
void setup(){
size(1400,600);
beton = loadImage("beton.png");
paille = loadImage("paille.png");
pierrebrise = loadImage("pierrebrise.png");
bois = loadImage("bois.png");
drapeau = loadImage("drapeau.png");
pierre = loadImage("pierre.png");
}
void draw(){
fill(255); rect(0, 0, 400, 600);
image(beton,0,0);
image(paille,0 ,50);
image(pierrebrise,0 ,100 );
image(bois,0 ,150);
image(pierre,0 ,200);
image(drapeau,0 ,250);
fill(0); // Txts explicatifs des diff. blocs....
text("Béton", 50, 25);
text("Paille", 50, 75);
text("Pierre brisée", 50, 125);
text("Bois", 50, 175);
text("Pierre", 50, 225);
text("Drapeau", 50, 275);
if ((mouseX > -1)&&(mouseX < 41)&&(mouseY > -1)&&(mouseY < 41)) { // détecte la souris
fill(0);
text("Le Béton est indestructible!", 150, 24); // affiche le txt à x=150 y=24
}
if ((mouseX > -1)&&(mouseX < 41)&&(mouseY > 49)&&(mouseY < 90)) { // détecte la souris
fill(0);
text("La paille est !", 150, 75); //affiche le txt à x=150 y=75
}
if ((mouseX > -1)&&(mouseX < 41)&&(mouseY > 100)&&(mouseY < 140)) { // détecte la souris
fill(0);
text("La pierre brisée...!", 150, 125); // affiche le txt à x=150 y=125
}
if ((mouseX > -1)&&(mouseX < 41)&&(mouseY > 150)&&(mouseY < 190)) { // détecte la souris
fill(0);
text("Le bois..!", 150, 175); // affiche le txt à x=150 y=175
}
if ((mouseX > -1)&&(mouseX < 41)&&(mouseY > 200)&&(mouseY < 240)) { // détecte la souris
fill(0);
text("La pierre!", 150, 225); // affiche le txt à x=150 y=225
}
if ((mouseX > -1)&&(mouseX < 41)&&(mouseY > 250)&&(mouseY < 390)) { // détecte la souris
fill(0);
text("Le Drapeau!", 150, 275); // affiche le txt à x=150 y=275
}
fill(255);
for (int i=400; i<width; i+=40)
{
for (int j=0; j<height; j+=40)
{
rect(i, j, 40, 40);
}
}
}
// chaq type de bloc est lié a un nbre 1 paille 2 bois 3 pierre 4 pierrebrisée 5 beton 6 drapeau |
Partager