joystick_check_button() (Game Maker)

joystick_check_button()

(Game Maker 6.1, 7)

joystick_check_button - check to see if a button is pressed on a joystick

Description

bool = joystick_check_button ( joystick, button )

  • bool - 0 or 1
  • joystick - 1 or 2
  • button - number of button to check

joystick_check_button() checks to see if a button is currently held down on a joystick and returns either (not held down) or 1 (held down). It accepts two arguments. First, the joystick to check. Since Game Maker only supports two joysticks, this must either be 1 or 2. The second argument is the number of the button to check.

Examples

Example of Use

if(joystick_button(1,1))
{
    //jump code here
}

In this example, if the first button on the first joystick is held down, the code to make a character jump will be executed.

Related Pages

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.