With this function you can check to see if a key is held down or not.
The function will take a keycode value as returned by the function ord (only capital letters from A-Z or numbers from 0-9), or any of the vk_* constants listed on the main Keyboard Input page.
Unlike the keyboard_check_pressed or keyboard_check_released functions which are only triggered once when the key is pressed or released, this function is triggered every step that the key is held down for.
keyboard_check(key);
Argument | Type | Description |
---|---|---|
key | Virtual Key Constant (vk_*) | The key to check the down state of. |
if keyboard_check(vk_left)
{
x -= 5;
}
The above code will check to see if the arrow key is being pressed and move the instance 5 pixels left every step that it returns true.