blob: 7450d9c19bbf494ebeff0626f9f04497158676d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
SCA_KeyboardSensor(SCA_ISensor)
===============================
base class --- :class:`SCA_ISensor`
.. class:: SCA_KeyboardSensor(SCA_ISensor)
A keyboard sensor detects player key presses.
See module :mod:`bge.events` for keycode values.
.. attribute:: key
The key code this sensor is looking for.
:type: keycode from :mod:`bge.events` module
.. attribute:: hold1
The key code for the first modifier this sensor is looking for.
:type: keycode from :mod:`bge.events` module
.. attribute:: hold2
The key code for the second modifier this sensor is looking for.
:type: keycode from :mod:`bge.events` module
.. attribute:: toggleProperty
The name of the property that indicates whether or not to log keystrokes as a string.
:type: string
.. attribute:: targetProperty
The name of the property that receives keystrokes in case in case a string is logged.
:type: string
.. attribute:: useAllKeys
Flag to determine whether or not to accept all keys.
:type: boolean
.. attribute:: events
a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
:type: list [[:ref:`keycode<keyboard-keys>`, :ref:`status<input-status>`], ...]
.. method:: getKeyStatus(keycode)
Get the status of a key.
:arg keycode: The code that represents the key you want to get the state of, use one of :ref:`these constants<keyboard-keys>`
:type keycode: integer
:return: The state of the given key, can be one of :ref:`these constants<input-status>`
:rtype: int
|