keyboard_key

Stores the current key being used.

Syntax:

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:

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.


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