You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

joystick_get_button

joystick_get_button(id)
Returns a button number of a given joystick, if pressed, or 0 if no button is pressed.
COPY/// joystick_get_button(id)
//
//  Returns a button number of a given joystick, if pressed,
//  or 0 if no button is pressed. If more than one button is 
//  pressed, the button with the lowest number is returned.
//
//      id          joystick id, real
//
/// GMLscripts.com/license
{
    var i;
    for (i=1; i<=joystick_buttons(argument0); i+=1) {
        if (joystick_check_button(argument0,i)) return i;
    } 
    return 0;
}

Contributors: BenRK

GitHub: View · Commits · Blame · Raw