keyboard_key

Stores the current key being used.

Syntax:

GML Code Example

keyboard_key;


Returns: Real


Description

With this variable you can get the keycode of the key that is currently being pressed and it will return 0 if no key is being pressed when the check is done.


Example:

GML Code Example

switch (keyboard_key)
    {
    case vk_numpad1: gun = weapon[0,0]; break;
    case vk_numpad2: gun = weapon[1,0]; break;
    case vk_numpad3: gun = weapon[2,0]; break;
    }
 

The above code uses the value of the keyboard_key variable to set a variable to the same value as an array.





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