SCA_KeyboardSensor(SCA_ISensor)
base class — SCA_ISensor
- class bge.types.SCA_KeyboardSensor
A keyboard sensor detects player key presses.
See module
bge.events
for keycode values.- key
The key code this sensor is looking for. Expects a keycode from
bge.events
module.- Type:
integer
- hold1
The key code for the first modifier this sensor is looking for. Expects a keycode from
bge.events
module.- Type:
integer
- hold2
The key code for the second modifier this sensor is looking for. Expects a keycode from
bge.events
module.- Type:
integer
- toggleProperty
The name of the property that indicates whether or not to log keystrokes as a string.
- Type:
string
- targetProperty
The name of the property that receives keystrokes in case in case a string is logged.
- Type:
string
- useAllKeys
Flag to determine whether or not to accept all keys.
- Type:
boolean
- inputs
A list of pressed input keys that have either been pressed, or just released, or are active this frame. (read-only).
- Type:
dict[keycode,
SCA_InputEvent
]
- events
a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
Deprecated since version 0.2.2: Use
inputs
- getKeyStatus(keycode)
Get the status of a key.
- Parameters:
keycode (integer) – The code that represents the key you want to get the state of, use one of these constants
- Returns:
The state of the given key, can be one of these constants
- Return type:
int