diff --git a/build/boucle_de_jeu/boucle_de_jeu.pde b/build/boucle_de_jeu/boucle_de_jeu.pde index 762d1605b812c1c86af01edfaee9ad548d043835..c5d572ad55831b2818db32ef4ab35541de28f929 100644 --- a/build/boucle_de_jeu/boucle_de_jeu.pde +++ b/build/boucle_de_jeu/boucle_de_jeu.pde @@ -53,6 +53,10 @@ PImage menu; PImage mortImage; PImage troiscoeur; PFont font; +String save; +String[] leaderBoard; +int highCombo; +int highScore; SoundFile instructions ; @@ -135,6 +139,11 @@ void setup() { background(menu); font = createFont("samurai.ttf", 70); noFill(); + + String save = new String(); + String[] leaderBoard = loadStrings("save.txt"); + highScore = int(leaderBoard[0]); + highCombo = int(leaderBoard[1]); } void slash(float a,float b,float c,float d,color col,float offset,float lastcomp, float comp){ stroke(col); @@ -162,6 +171,7 @@ void draw() { textFont(font); text("Play", startX+startSizeX/3, startY2+startSizeY/3, startSizeX, startSizeY); text("Instructions", startX+startSizeX/50, startY+startSizeY/3, startSizeX, startSizeY); + text("Highscore : " + highScore,0,0); break; case 1 : //Correspond au jeu en lui-même if (vie == 3){ @@ -336,6 +346,12 @@ void draw() { break; case 2 : //Correspond à la mort du joueur + if (score > highScore){ + highScore = score; + } + if (max_combo > highCombo){ + highCombo = max_combo; + } textFont(font); fill(245,24,1); text("Game Over",displayWidth/4.3,displayHeight/2); @@ -389,6 +405,10 @@ public void onPause() { } } +public void stop(){ + saveStrings("save.txt", new String[]{str(highScore), str(highCombo)}); +} + class AccelerometerListener implements SensorEventListener { public void onSensorChanged(SensorEvent event) { ax = event.values[0]; diff --git a/build/boucle_de_jeu/save.txt b/build/boucle_de_jeu/save.txt new file mode 100644 index 0000000000000000000000000000000000000000..9aea9e0ce5f29b6de4471bfcb57af3538d4a669e --- /dev/null +++ b/build/boucle_de_jeu/save.txt @@ -0,0 +1,2 @@ +0 +0 \ No newline at end of file