Mouse sensor

Option(s) of the Mouse sensor :

  • Mode : Left Button (1) , Middle Button (2) , Right Button (3) , Wheel Up (4) , Wheel Down (5) , Movement (9) , Mouse Over (0) , Mouse Over Any (0 ?)
  • Status : Left Button (= 189 = bge.events.LEFTMOUSE ) , Middle Button (= 190 = bge.events.MIDDLEMOUSE) , Right Button (= 191 = bge.events.RIGHTMOUSE)
  • Common options of all Sensors

Python :

# import bge module
import bge
 
# get the controller
cont = bge.logic.getCurrentController()
 
# get the sensor attached to the controller
# my sensor is named Trigger
sen = cont.sensors["Trigger"]
  • sen.mode : the current mode
  • sen.position : the position [width, height] in pixels of your cursor on your gaming screen
  • sen.getButtonStatus(189) : the status of the Left button
    0 = INPUT_NONE
    1 = INPUT_JUST_ACTIVATED
    2 = INPUT_ACTIVE
    3 = INPUT_JUST_RELEASED
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License