diff --git a/build/boucle_de_jeu/boucle_de_jeu.pde b/build/boucle_de_jeu/boucle_de_jeu.pde index 8b197e0c9b65910e4a8acfe95f6f02523d0b5233..fbb8467510571b17bec8af382da644e5bd75464f 100644 --- a/build/boucle_de_jeu/boucle_de_jeu.pde +++ b/build/boucle_de_jeu/boucle_de_jeu.pde @@ -16,7 +16,7 @@ float ax, ay, az; SoundFile droite1, droite2, droite3, gauche1, gauche2, gauche3, neutre1, neutre2, neutre3; SoundFile epee1, epee2, epee3, woosh, clang1, clang2, clang3; SoundFile cri1, cri2; -SoundFile bgMusic, mort, aie; +SoundFile bgMusic, battle, mort, aie, gameover; KalmanFilter kf = new KalmanFilter(); float timer; float cooldown_listener; @@ -30,6 +30,7 @@ float init_cooldown; float reaction; float init_reaction; int ennemy_move; //0 : droite, 1 : gauche, 2 : neutre. +boolean gameoverhasplayed; float comp; float lastcomp; float a; @@ -84,6 +85,7 @@ void setup() { score = 0; combo = 0; ennemy_move = -1; + gameoverhasplayed = false; comp = 0; lastcomp = 0; @@ -100,7 +102,7 @@ void setup() { //sons bgMusic = new SoundFile(this, "bgmusic.wav"); - bgMusic.loop(); + battle = new SoundFile(this, "battle.wav"); droite1 = new SoundFile(this, "droite1.wav"); droite2 = new SoundFile(this, "droite2.wav"); droite3 = new SoundFile(this, "droite3.wav"); @@ -113,14 +115,15 @@ void setup() { epee1 = new SoundFile(this, "sching.wav"); epee2 = new SoundFile(this, "schyang.wav"); epee3 = new SoundFile(this, "sling.wav"); - woosh = new SoundFile(this, "woosh.mp3"); - clang1 = new SoundFile(this, "bangbang.mp3"); - clang2 = new SoundFile(this, "pafpaf.mp3"); - clang3 = new SoundFile(this, "bonk.mp3"); + woosh = new SoundFile(this, "woosh.wav"); + clang1 = new SoundFile(this, "bangbang.wav"); + clang2 = new SoundFile(this, "pafpaf.wav"); + clang3 = new SoundFile(this, "bonk.wav"); aie = new SoundFile(this, "aie.wav"); mort = new SoundFile(this, "mort.wav"); - cri1 = new SoundFile(this, "cri.mp3"); + cri1 = new SoundFile(this, "cri.wav"); cri2 = new SoundFile(this, "rale.wav"); + gameover = new SoundFile(this, "gameover.wav"); instructions = new SoundFile(this, "instructions.wav"); textFont(createFont("SansSerif", 30 * displayDensity)); @@ -161,7 +164,7 @@ void slash(float a,float b,float c,float d,color col,float offset,float lastcomp void fade(int n){ - pg = createGraphics(displayWidth,displayHeight); + pg = createGraphics(displayWidth,displayHeight); pg.beginDraw(); pg.background(0,0,0,n); pg.endDraw(); @@ -171,6 +174,10 @@ void draw() { switch(mode){ case 0 : //Correspond au menu de jeu + gameoverhasplayed = false; + if (!bgMusic.isPlaying()){ + bgMusic.play(); + } vie = 3; stroke(0); fill(startColor); @@ -184,6 +191,15 @@ void draw() { text("Highcombo : " + highCombo,displayWidth/9,displayHeight/20); break; case 1 : //Correspond au jeu en lui-même + + if (bgMusic.isPlaying() || instructions.isPlaying()){ + instructions.stop(); + bgMusic.stop(); + } + if (!battle.isPlaying()){ + battle.play(); + } + if (vie == 3){ image(troiscoeur, 0, 0, displayWidth, troiscoeur.height * (displayWidth/troiscoeur.width)); } @@ -344,6 +360,8 @@ void draw() { if (vie > 0) aie.play(); //animation sur les coeurs if (vie <= 0){ + battle.stop(); + mort.play(); mode = 2; background(mortImage); } @@ -356,6 +374,7 @@ void draw() { break; case 2 : //Correspond à la mort du joueur +<<<<<<< HEAD if (score > highScore){ highScore = score; } @@ -375,6 +394,23 @@ void draw() { text("Retour menu", startX+startSizeX/20, startY+startSizeY/3, startSizeX, startSizeY); text("Combo max : " + max_combo + "\nScore : " + score, startX, startY2+startSizeY/6, startSizeX+displayWidth/10, startSizeY); break; +======= + if (!gameoverhasplayed){ + gameoverhasplayed = true; + gameover.play(); + } + textFont(font); + fill(245,24,1); + text("Game Over",displayWidth/4.3,displayHeight/2); + fill(255,255,255,100); + rect(startX, startY, startSizeX, startSizeY); + fill(255,255,255,100); + rect(startX-displayWidth/20, startY2, startSizeX+displayWidth/10, startSizeY); + fill(0,0,0,100); + text("Retour menu", startX+startSizeX/20, startY+startSizeY/3, startSizeX, startSizeY); + text("Combo max : " + max_combo + "\nScore : " + score, startX, startY2+startSizeY/6, startSizeX+displayWidth/10, startSizeY); + break; +>>>>>>> 80a6e31a4a366f47a0b6c5c453da4a88822dcbb8 } } diff --git a/build/boucle_de_jeu/data/battle.mp3 b/build/boucle_de_jeu/data/battle.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..83f5d50b1041c81937bbaef24e9bd9bd62fce72c Binary files /dev/null and b/build/boucle_de_jeu/data/battle.mp3 differ diff --git a/build/boucle_de_jeu/data/build_boucle_de_jeu_data_battle.wav b/build/boucle_de_jeu/data/build_boucle_de_jeu_data_battle.wav new file mode 100644 index 0000000000000000000000000000000000000000..5f4f7be7e9b5c7e31fe4833cbf2d735d8a8f3e05 Binary files /dev/null and b/build/boucle_de_jeu/data/build_boucle_de_jeu_data_battle.wav differ diff --git a/build/boucle_de_jeu/data/build_boucle_de_jeu_data_battle_moin_fort.wav b/build/boucle_de_jeu/data/build_boucle_de_jeu_data_battle_moin_fort.wav new file mode 100644 index 0000000000000000000000000000000000000000..48e9b3ec2900ded3d0dc3168c37d6e61ef79116c Binary files /dev/null and b/build/boucle_de_jeu/data/build_boucle_de_jeu_data_battle_moin_fort.wav differ diff --git a/build/boucle_de_jeu/data/gameover.mp3 b/build/boucle_de_jeu/data/gameover.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..a236970acbbe55a722deffe4eff68bf4d0409037 Binary files /dev/null and b/build/boucle_de_jeu/data/gameover.mp3 differ