diff --git a/build/boucle_de_jeu/boucle_de_jeu.pde b/build/boucle_de_jeu/boucle_de_jeu.pde index 0105482c50ae107666a0d25acc70510cd7ef8f1d..762d1605b812c1c86af01edfaee9ad548d043835 100644 --- a/build/boucle_de_jeu/boucle_de_jeu.pde +++ b/build/boucle_de_jeu/boucle_de_jeu.pde @@ -4,6 +4,7 @@ import android.hardware.SensorManager; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import processing.sound.*; +PGraphics pg; Context context; SensorManager manager; @@ -36,6 +37,8 @@ float c; float d; float offset; boolean is_slash; +boolean fadeout; +int alph; int mode; //int nbrSound; @@ -48,7 +51,7 @@ boolean instructionsOver; PImage menu; PImage mortImage; -PImage troiscoeur, deuxcoeur, uncoeur; +PImage troiscoeur; PFont font; SoundFile instructions ; @@ -84,6 +87,8 @@ void setup() { d = random(displayHeight/5,displayHeight-displayHeight/5); offset = random(0,2*PI); is_slash = false; + fadeout = false ; + alph = 0; frameRate(60); @@ -125,8 +130,6 @@ void setup() { menu = loadImage("menu.jpg"); mortImage = loadImage("mort.png"); troiscoeur = loadImage("3coeur.png"); - deuxcoeur = loadImage("2coeur.png"); - uncoeur = loadImage("1coeur.png"); menu.resize(displayWidth, displayHeight); mortImage.resize(displayWidth, displayHeight); background(menu); @@ -140,6 +143,14 @@ void slash(float a,float b,float c,float d,color col,float offset,float lastcomp if (comp < PI/2){strokeWeight(comp*5);} if (comp > PI/2) {strokeWeight(PI/2*5 - (comp%(PI/2))*5);} } + +void fade(int n){ + pg = createGraphics(displayWidth,displayHeight); + pg.beginDraw(); + pg.background(0,0,0,n); + pg.endDraw(); + image(pg,0,0); + } void draw() { switch(mode){ case 0 : //Correspond au menu de jeu @@ -153,9 +164,7 @@ void draw() { text("Instructions", startX+startSizeX/50, startY+startSizeY/3, startSizeX, startSizeY); break; case 1 : //Correspond au jeu en lui-même - - //affichage des coeurs - if (vie == 3){ + if (vie == 3){ image(troiscoeur, 0, 0, displayWidth, troiscoeur.height * (displayWidth/troiscoeur.width)); } if (vie == 2){ @@ -164,11 +173,11 @@ void draw() { if (vie == 1){ image(uncoeur, 0, 0, displayWidth, uncoeur.height * (displayWidth/uncoeur.width)); } - + //dessiner les courbes de Kiwi noFill(); - if (is_slash == true){ - if (comp == 0) {background(0);} + if (is_slash){ + slash(a,b,c,d,#FFFFFF,offset,lastcomp,comp); slash(a+5,b+5,c,d,#FF0000,offset + PI/4,lastcomp,comp); slash(a+10,b+10,c,d,#FFFFFF,offset + 2*PI/4,lastcomp,comp); @@ -177,7 +186,21 @@ void draw() { lastcomp = comp; comp = comp + PI/20; } + if (fadeout){ + + alph = alph + 1; + if (alph > 35){ + fadeout = false; + alph = 0; + } + else{ + + fade(alph); + } + } + if (comp > PI){ + fadeout = true; a = random(displayWidth/10,displayWidth-displayWidth/10); b = random(displayHeight/10,displayHeight-displayHeight/10); c = random(displayWidth/5,displayWidth-displayWidth/5); diff --git a/build/boucle_de_jeu/data/1coeur.png b/build/boucle_de_jeu/data/1coeur.png index d2e45f3339496103758b2ff0e454904f798ecdee..d3ae292dbc81a6d67acf95f7c63dcd94c089da75 100644 Binary files a/build/boucle_de_jeu/data/1coeur.png and b/build/boucle_de_jeu/data/1coeur.png differ diff --git a/build/boucle_de_jeu/data/2coeur.png b/build/boucle_de_jeu/data/2coeur.png index 831372a27ee793e680df3a6c536258db38b45350..0c85a4e12d5d17a08d0d6ff7fee5b6c49bd0064b 100644 Binary files a/build/boucle_de_jeu/data/2coeur.png and b/build/boucle_de_jeu/data/2coeur.png differ diff --git a/build/boucle_de_jeu/data/3coeur.png b/build/boucle_de_jeu/data/3coeur.png index 45d5d3e2f2732e9ec9a240fae6209abad8d8d43f..b2ab5f9c2ed902f35ca73d4a3fe288181dfda982 100644 Binary files a/build/boucle_de_jeu/data/3coeur.png and b/build/boucle_de_jeu/data/3coeur.png differ