diff --git a/labyrinthe/2-python/2-labyrinthe.py b/labyrinthe/2-python/2-labyrinthe.py index bd9e3e0..98cd37e 100644 --- a/labyrinthe/2-python/2-labyrinthe.py +++ b/labyrinthe/2-python/2-labyrinthe.py @@ -127,7 +127,8 @@ def victoire_fermer(cont): scene.objects['Bille']['z']= -21 # On provoque le redémarrage si la bille est ressortie ############################################################################### -# Gestion du Joystick +# Gestion du Joystick (Joystick USB) +# Partie non abordée dans le tutoriel ############################################################################### def joystick(cont): diff --git a/labyrinthe/3-arduino_pyfirmata/3-labyrinthe.py b/labyrinthe/3-arduino_pyfirmata/3-labyrinthe.py index c6fcad8..9510bae 100644 --- a/labyrinthe/3-arduino_pyfirmata/3-labyrinthe.py +++ b/labyrinthe/3-arduino_pyfirmata/3-labyrinthe.py @@ -204,40 +204,3 @@ def victoire_fermer(cont): scene.objects['Panneau victoire'].setVisible(False,True) # Cacher le panneau de la victoire scene.objects['Panneau victoire - plan'].suspendPhysics (True) # Suspendre la physique du panneau cliquable scene.objects['Bille']['z']= -21 # On provoque le redémarrage si la bille est ressortie - -############################################################################### -# Gestion du Joystick USB -############################################################################### - -def joystick(cont): - obj = cont.owner - joystickIndex = 0 #int from 0 to 6 - joy = bge.logic.joysticks[joystickIndex] - events = joy.activeButtons - axis = joy.axisValues[0:4] - resolution = 0.01 - - leftStick_x = axis[0]; leftStick_y = axis[1] - rightStick_x = axis[2]; rightStick_y = axis[3] - - #if any button is pressed - # if events: - # print(events) #spit out integer index of pressed buttons - # if 0 in events: - # doSomething() - - # Up - if leftStick_y <-0.1 : - obj.applyRotation((-resolution,0,0), False) - - # Down - if leftStick_y >0.1 : - obj.applyRotation((resolution,0,0), False) - - # Left - if leftStick_x <-0.1 : - obj.applyRotation((0, -resolution,0), False) - - # Right - if leftStick_x >0.1 : - obj.applyRotation((0, resolution,0), False) diff --git a/labyrinthe/4-arduino_pyserial/4-labyrinthe.py b/labyrinthe/4-arduino_pyserial/4-labyrinthe.py index 25fefc3..f22152c 100644 --- a/labyrinthe/4-arduino_pyserial/4-labyrinthe.py +++ b/labyrinthe/4-arduino_pyserial/4-labyrinthe.py @@ -234,40 +234,3 @@ def victoire_fermer(cont): serial_msg_out = "90\n" # Afficher image de début (flèches) sur la matrice de leds serial_comm.write(serial_msg_out.encode()) # scene.objects['Bille']['z']= -21 # On provoque le redémarrage si la bille est ressortie - -############################################################################### -# Gestion du Joystick USB -############################################################################### - -def joystick(cont): - obj = cont.owner - joystickIndex = 0 #int from 0 to 6 - joy = bge.logic.joysticks[joystickIndex] - events = joy.activeButtons - axis = joy.axisValues[0:4] - resolution = 0.01 - - leftStick_x = axis[0]; leftStick_y = axis[1] - rightStick_x = axis[2]; rightStick_y = axis[3] - - #if any button is pressed - # if events: - # print(events) #spit out integer index of pressed buttons - # if 0 in events: - # doSomething() - - # Up - if leftStick_y <-0.1 : - obj.applyRotation((-resolution,0,0), False) - - # Down - if leftStick_y >0.1 : - obj.applyRotation((resolution,0,0), False) - - # Left - if leftStick_x <-0.1 : - obj.applyRotation((0, -resolution,0), False) - - # Right - if leftStick_x >0.1 : - obj.applyRotation((0, resolution,0), False)