keyboard_check_pressed

With this function you can check to see if a key has been pressed or not.

Unlike the keyboard_check function, this function will only return true in the step the key is pressed down, i.e. when it switches from not held down in the previous step to held down in the current step. So for it to return true again, the key must be first released and then pressed again. In all other steps, the function returns false.

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.

 

Syntax:

keyboard_check_pressed(key);

Argument Type Description
key Virtual Key Constant (vk_*) The key to check the pressed state of.

 

Returns:

Boolean

 

Example:

if keyboard_check_pressed(vk_anykey)
{
    room_goto_next();
}

The above code will advance to the next room if the player presses any of the keyboard's keys (working like a "Press Any Key to Continue" prompt).