joystick_get_button

Downloadjoystick_get_button(id)   Returns the number of the button pressed on the given joystick, or zero if no button is pressed.
/*
**  Usage:
**      joystick_get_button(id)
**
**  Arguments:
**      id      joystick id
**
**  Returns:
**      the number of the button pressed on the given
**      joystick, or zero if no button is pressed
**
**  Notes:
**      If more than one button is pressed, the button
**      with the lowest number will be returned.
**
**  GMLscripts.com
*/

{
    var i;
    for (i=1; i<=joystick_buttons(argument0); i+=1) {
        if (joystick_check_button(argument0,i)) return i;
    }
    return false;
}

Click if you've used this script[Please Login]
Projects: 12

 Contributor: BenRK


comments powered by Disqus