Difference between revisions of "Key.pressed"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | <c>key.pressed</c> detects whether a specific key or button input is currently pressed. | + | <c>[[key]].pressed</c> detects whether a specific key or button input is currently pressed. |
See also: [[key.keyNames]]; [[key.axis]] | See also: [[key.keyNames]]; [[key.axis]] |
Revision as of 19:59, 24 March 2020
key.pressed
detects whether a specific key or button input is currently pressed.
See also: key.keyNames; key.axis
Arguments
Parameter Name | Type | Default Value | Meaning |
---|---|---|---|
keyName | string | "space" | key/button to press |
Usage Notes
These include modifier keys (e.g. "left shift", "right alt") as well as mouse buttons (e.g. "mouse 0") and joystick/gamepad buttons ("joystick 1 button 0", etc.). With regard to joystick buttons, if you don't specify a number (e.g. "joystick button 0"), then it will detect a press of button 0 on *any* joystick. See key.keyNames for all the possible names to use with this method.
Example
while not key.pressed("left"); end while // waits until left arrow pressed