Returns whether a given gamepad button is currently down.


gamepad_button_check(device, button);

Argument Description
device Which gamepad device "slot" to check.
button Which gamepad button constant to check for.

Returns: Boolean


This function will return true or false depending on whether the given gamepad button is detected as being held down or not.


if gamepad_button_check(0, gp_face1)
   if canshoot = true
      audio_sound_play(snd_Shoot, 0, false);
      instance_create(x, y, obj_Bullet)
      canshoot = false;
      alarm[0] = room_speed / 2;

The above code will detect whether the bottom button of the top face (the "X" on a ps3 controller) is being held down and if so, it will shoot a "bullet" instance and set an alarm.

Back: GamePad Input
Next: gamepad_button_check_pressed
© Copyright YoYo Games Ltd. 2018 All Rights Reserved