keyboard_check_pressed

Returns whether the given key on the keyboard has just been pressed.

Syntax:

keyboard_check_pressed(key);


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


Returns: Boolean


Description

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 run once for every time the key is pressed down, so for it to trigger again, the key must be first released and then pressed again.


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).


Back: Keyboard Input
Next: keyboard_check_released
© Copyright YoYo Games Ltd. 2018 All Rights Reserved