Keyboard_check_released()
#1
Posted 15 November 2008 - 02:48 AM
I need game maker to check wether any ARROW KEY has been released. Is it possible?
if yes how?
#2
Posted 15 November 2008 - 02:49 AM
#3
Posted 15 November 2008 - 02:53 AM
Well, you have a few options. You can either type it out four times, or hope the player absolutely never presses any other key.
in other words... no.
EDIT: whats keyboard_check_direct() ???
Edited by Obj_Control, 15 November 2008 - 02:54 AM.
#4
Posted 15 November 2008 - 02:55 AM
#5
Posted 15 November 2008 - 03:03 AM
If you look on the toolbar of any window on Game Maker, you'll see a ? in a circle. This is the GM Bible, consult it regularly.
never knew it existed... took a while to find...
#6
Posted 15 November 2008 - 03:30 AM
if keyboard_check_released(vk_left or vk_right or vk_down or vk_up)
{
//do whatever
}
#7
Posted 15 November 2008 - 03:43 AM
you could do
if keyboard_check_released(vk_left or vk_right or vk_down or vk_up) { //do whatever }
well.. shoulda checked earlier... I've found an alternate solution but that's WAY more simple...
#8
Posted 15 November 2008 - 04:00 AM
#9
Posted 15 November 2008 - 06:53 AM
#10
Posted 15 November 2008 - 07:03 AM
It only 'works' by sheer coincidence.Wait, that actually works? Last time I tried it it didn't work...
Because 'or' is used, GM evaluates each section as a separate expression. All of the key codes used have internal values larger than 0 (vk_left=37, etc.) so GM automatically evaluates that section to true. Because at least one (all in this case) of the sections are true then the entire expression inside the brackets is evaluated to true. In Game Maker, 'true' is treated as 1. The special keycode, vk_anykey, has an internal value of 1. Thus, because the expression evaluates to true (1), gamemaker treats it as the key with the keycode of 1, vk_anykey.
EDIT: Made my post slightly less confusing.
Edited by $pecter, 15 November 2008 - 07:39 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











