gamepad_button_check

Returns whether a given gamepad button is currently down.

Syntax:

gamepad_button_check(device, button);


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


Returns: Boolean


Description

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


Example:

if gamepad_button_check(0, gp_face1)
   {
   if canshoot = true
      {
      audio_play_sound(snd_Shoot, 0, false);
      instance_create_layer(x, y, "Bullets", 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