Jump to content


Photo

Keyboard_check_released()


  • Please log in to reply
9 replies to this topic

#1 Obj_Control

Obj_Control

    GM Mentor

  • New Member
  • 2561 posts

Posted 15 November 2008 - 02:48 AM

Is it possible to use keyboard_check_released(vk_any) ???

I need game maker to check wether any ARROW KEY has been released. Is it possible?

if yes how?
  • 0

#2 theBlighter

theBlighter

    GMC Member

  • New Member
  • 177 posts

Posted 15 November 2008 - 02:49 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.
  • 0

#3 Obj_Control

Obj_Control

    GM Mentor

  • New Member
  • 2561 posts

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.

  • 0

#4 theBlighter

theBlighter

    GMC Member

  • New Member
  • 177 posts

Posted 15 November 2008 - 02:55 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.
  • 0

#5 Obj_Control

Obj_Control

    GM Mentor

  • New Member
  • 2561 posts

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...
  • 0

#6 supercarson7

supercarson7

    GMC Member

  • New Member
  • 114 posts

Posted 15 November 2008 - 03:30 AM

you could do
if keyboard_check_released(vk_left or vk_right or vk_down or vk_up)
 {
 //do whatever
 }

  • 0

#7 Obj_Control

Obj_Control

    GM Mentor

  • New Member
  • 2561 posts

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...
  • 0

#8 supercarson7

supercarson7

    GMC Member

  • New Member
  • 114 posts

Posted 15 November 2008 - 04:00 AM

ok thanks.
  • 0

#9 theBlighter

theBlighter

    GMC Member

  • New Member
  • 177 posts

Posted 15 November 2008 - 06:53 AM

Wait, that actually works? Last time I tried it it didn't work...
  • 0

#10 $pecter

$pecter

    GMC Member

  • GMC Member
  • 1616 posts
  • Version:GM8

Posted 15 November 2008 - 07:03 AM

Wait, that actually works? Last time I tried it it didn't work...

It only 'works' by sheer coincidence.

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users