natiny.input.get_key_pressed
natiny.input.get_key_pressed(key) -> boolean
Returns true only on the frame when the specified key was first pressed 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 on the frame the key was pressed, false otherwise |
Example
if natiny.input.get_key_pressed(natiny.input.KEY_SPACE) then
jump()
end