Joystick Sensor Axis: connected

connected
  • Returns if the selected joystick is connected to the sensor.

Type: 
  • boolean

values:

  • True = found joystick
      
  • False = didn't find joystick
Joystick Axis Sensor:
  • Up to 8 joysticks can be connected.
  • Moving the joystick in the selected Axis Direction sends a positive pulse to the connected controller(s).
  • Returning the joystick to the center sends a negative pulse to the connected controller(s).
Sample Code


################  Find out if joystick is connected

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Turn

sen = cont.sensors["Turn"]

# joystick connected?
joystick_Connect = sen.connected