Mouse Sensor Left Button: mode

mode
  • gets/sets the Mouse Event that triggers the mouse sensor.

Type: 
  • integer

Values:

  • 1 = LEFT BUTTON
     
  • 2 = MIDDLE BUTTON
     
  • 3 = RIGHT BUTTON
     
  • 4 = WHEEL UP
     
  • 5 = WHEEL DOWN
     
  • 9 = MOVEMENT
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 mode that triggers mouse sensor
 
# 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 mode
mode_Mouse = sen.mode
 
Sample Code


################  Set mode that triggers mouse sensor
 
# 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"]

# set mode to mouse left button
#mode for left mouse button is 1
sen.mode = 1