Checks to see if a joystick button has been pressed.


joystick_check_button(id, numb);

Argument Description
id The id of the joystick (1 or 2).
numb The number of the button to check (from 1 to 32).

Returns: Boolean


This function will return true if the selected button on the joystick/gamepad with the given id is being pressed and false if it is not. The id can be either 1 or 2 as GameMaker: Studio only accepts input from a maximum of two joysticks/gamepads.

NOTE: This function is only available for Windows.


if joystick_check_button(1, 1)
   if canshoot
      canshoot = !canshoot;
      alarm[0] = 10;
      instance_create(x, y, obj_Bullet);

The above code checks to see if a joystick or gamepad button is being pressed and if it returns true it checks a variable and creates a bullet object.

Back: Joystick Input
Next: joystick_xpos
© Copyright YoYo Games Ltd. 2018 All Rights Reserved