When you write a program, there's a fair chance you'll need the keyboard! This simple article will show how you can easily retrieve input from your keyboard!
Virtual keys
Reading a key
Other keys
Game maker uses unicode for the remaining keys. So to see if the A key is pressed, you'd need to check 65.
However!
Shorter code
Keybinds
Other checks
There are a few other events you can check for when a key is pressed as well. These make life a bit easier!
|
Example of use:
If we were to use the "pressed" event for both keys, you'd have to press control and c at exactly the same time, so they both register simultaneously. If we used a general "hold" event for both, the event would constantly be triggering throughout the press. Neither are ideal, so this is the solution:
GML
if keyboard_check( vk_control ) and keyboard_check_pressed( ord( "V" ) )
{
//Single paste event -->
}
Overriding input
The clipboard
Enjoy this article?