Mouse Sensor Left Button: getButtonStatus

getButtonStatus(button)
  • Returns the status of the selected mouse button

Type: 
  • integer

Values:

  • 0 = INPUT_NONE
     
  • 1 = INPUT_JUST_ACTIVATED
     
  • 2 = INPUT_ACTIVE
     
  • 3 = INPUT_JUST_RELEASED

button:

  • Type:  integer or bge.events member
     
  • 189 = bge.events.LEFTMOUSE = left button
     
  • 190 = bge.events.MIDDLEMOUSE = middle button
     
  • 191 = bge.events.RIGHTMOUSE = right button
Mouse Sensor:
  • Left mouse button pressed:  One positive pulse is sent to the connected controller(s).
  • Left mouse button released:  One negative pulse is sent to the connected controller(s).
Sample Code


################  Get mouse left button status
 
# 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"]

# get mouse left button status
# Key code for left mouse button is 189
LB_Mouse = sen.getButtonStatus(189)