gamepad_button_check_pressed

Returns whether a given gamepad button has been pressed.

Syntax:

gamepad_button_check_pressed(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 having been pressed or not. Note that this function will only trigger once for the button the first time it is pressed. For it to trigger again the button must first be released and then re-pressed. If you need to check a continuous press of the button you should be using the function gamepad_button_check.


Example:

if gamepad_button_check_pressed(0, gp_start)
   {
   audio_sound_play(snd_Start, 0, false);
   room_goto(rm_Level_1);
   }

The above code will detect whether the "start" button of the gamepad connected to device "slot" 0 has been pressed or not and change room if it has.


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