keyboard_check() (Game Maker)

( Game Maker 6.1, 7 )

keyboard_check - check to see if a key is held down


bool = keyboard_check ( keycode )

keyboard_check() checks to see if a key is held down and returns a 1 if it is, and a if it is not. It accepts the keycode of the key to check as its argument.

To find the proper keycode, Game Maker has a number of keycode constants for the most commonly used keys. If you need a letter, you can use ord().


Example of Use

    show_message("Don't press space.");

In this example, keyboard_check() is used to see if space is held down. It it is, a message will pop up.

Using Ord

If you need a to check a key that is not represented in a keycode constant, such as a letter, you can use ord() instead.

  show_message("You have pressed w");

Related Pages

Similar To

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.