Returns whether the key with the particular keycode is pressed by checking the hardware directly.


GML Code Example


Argument Description
key The key to check the down state of.

Returns: Boolean


This function will return true if the key with the particular keycode is pressed, or false if it is not, by checking the hardware directly. It allows for a few more checks, in particular you can use keycodes vk_lshift, vk_lcontrol, vk_lalt, vk_rshift, vk_rcontrol and vk_ralt to check whether the left or right shift, control or alt key is pressed.

NOTE: This function is only available for the standard Windows target and the result is independent of which application has focus.


GML Code Example

if keyboard_check_direct(vk_ralt) || keyboard_check_direct(vk_lalt)
    crouch = true;

The above code will check to see if either the left or right alt keys have been pressed, and if they have it sets the variable "crouch" to true.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here