Skip to content
Extraits de code Groupes Projets
Valider 5546e94f rédigé par Quentin LECOMTE's avatar Quentin LECOMTE
Parcourir les fichiers

Ajout des vibrations

parent 7c179f15
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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){
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter