Sensor Logic Brick: level

level
  • gets/sets whether or not the Level button is active.

Type: 
  • boolean

Values:

  • 1 = True = level button active
  • 0 = False = level button inactive
Sensor Logic Brick: level
  • The Level button is part of the State Mask Group System.
  • Sensors belong to a State Mask group(s).
  • State Mask groups (and the sensors belonging to them) can be deactivated and reactivated.
  • Level button enabled.  Deactivated sensor being reactivated:
    Checks to see if a mouse button/keyboard/etc is being pressed.
    If it is, it sends a pulse to the controller.
  • Level button not enabled.  Deactivated sensor being reactivated:
    Doesn't check to see if a mouse button/keyboard/etc is being pressed.
    Doesn't send a pulse to the controller.
Sample Code


################  get the Level 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 Sensor_1

sen = cont.sensors["Sensor_1"]

# get the Level button status
status = sen.level
 
Sample Code


################  set the level 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 Sensor_1

sen = cont.sensors["Sensor_1"]

# set the Level button to True
sen.level = True