diff --git a/build/boucle_de_jeu/boucle_de_jeu.pde b/build/boucle_de_jeu/boucle_de_jeu.pde index 46868d77c6f564a896deb2e96bb8310396ae38fd..296fa9c8ceb9f1aa26b74dcbea6630505e7b32dc 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 android.os.Environment; +import android.os.Vibrator; import processing.sound.*; PGraphics pg; @@ -17,6 +18,7 @@ SoundFile droite1, droite2, droite3, gauche1, gauche2, gauche3, neutre1, neutre2 SoundFile epee1, epee2, epee3, woosh, clang1, clang2, clang3; SoundFile cri1, cri2; SoundFile bgMusic, battle, mort, aie, gameover; +Vibrator vibrer; KalmanFilter kf = new KalmanFilter(); float timer; float cooldown_listener; @@ -72,6 +74,7 @@ void setup() { sensorG = manager.getDefaultSensor(Sensor.TYPE_GRAVITY); listenerA = new AccelerometerListener(); manager.registerListener(listenerA, sensorA, SensorManager.SENSOR_DELAY_GAME); + vibrer = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); seuil = 4; cooldown_listener = 0.5; @@ -315,6 +318,7 @@ void draw() { case 2 : clang3.play(); break; case 3 : cri2.play(); break; } + vibrer.vibrate(10); } //droite if (az < -seuil && ennemy_move == 0){ @@ -337,7 +341,7 @@ void draw() { case 2 : clang3.play(); break; case 3 : cri1.play(); break; } - + vibrer.vibrate(10); } //neutre if ((ax < -seuil || ax > seuil) && ennemy_move == 2){ @@ -360,11 +364,13 @@ void draw() { case 2 : clang3.play(); break; case 3 : woosh.play(); break; } + vibrer.vibrate(10); } reaction -= 0.017; } else if (reaction < 0 && ennemy_move != -1) { vie -= 1; combo = 0; + vibrer.vibrate(10); if (vie > 0) aie.play(); //animation sur les coeurs if (vie <= 0){