08.11.2012 Views

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

vk_insert insert key<br />

vk_pageup pageup key<br />

vk_pagedown pagedown key<br />

vk_pause pause/break key<br />

vk_printscreen printscreen/sysrq key<br />

vk_f1 ... vk_f12 keycodes for the function keys F1 to F12<br />

vk_numpad0 ... vk_numpad9 number keys on the numeric keypad<br />

vk_multiply multiply key on the numeric keypad<br />

vk_divide divide key on the numeric keypad<br />

vk_add add key on the numeric keypad<br />

vk_subtract subtract key on the numeric keypad<br />

vk_decimal decimal dot keys on the numeric keypad<br />

For the letter keys use for example ord('A'). (The capital letters.) For the digit keys use for<br />

example ord('5') to get the key. The following constants can only be used in<br />

keyboard_check_direct:<br />

vk_lshift left shift key<br />

vk_lcontrol left control key<br />

vk_lalt left alt key<br />

vk_rshift right shift key<br />

vk_rcontrol right control key<br />

vk_ralt right alt key<br />

For example, assume you have an object that the user can control <strong>with</strong> the arrow keys you<br />

can put the following piece of code in the step event of the object:<br />

{<br />

}<br />

if (keyboard_check(vk_left)) x -= 4;<br />

if (keyboard_check(vk_right)) x += 4;<br />

if (keyboard_check(vk_up)) y -= 4;<br />

if (keyboard_check(vk_down)) y += 4;<br />

Of course it is a lot easier to simply put this in the keyboard events.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!