natiny.input.get_key_down
natiny.input.get_key_down(key) -> boolean
Returns true if the specified keyboard key is currently held down.
Parameters
| Name | Type | Description |
|---|---|---|
key |
number |
Key code - a natiny.input.KEY_* constant, e.g. natiny.input.KEY_W |
Returns
| Type | Description |
|---|---|
boolean |
true if the key is held, false otherwise |
Example
if natiny.input.get_key_down(natiny.input.KEY_W) then
move_forward()
end
Notes
- Returns
trueevery frame as long as the key is held. - Key constants are listed in Key codes.