The Joystick

Game Maker 8

The joystick

There are some events associated with joysticks. But to have full control over the joysticks there is a whole set of functions to deal with joysticks. Game Maker supports up to two joysticks. So all of these functions take a joystick id as argument.

joystick_exists(id) Returns whether joystick id (1 or 2) exists.
joystick_name(id) Returns the name of the joystick
joystick_axes(id) Returns the number of axes of the joystick.
joystick_buttons(id) Returns the number of buttons of the joystick.
joystick_has_pov(id) Returns whether the joystick has point-of-view capabilities.
joystick_direction(id) Returns the keycode (vk_numpad1 to vk_numpad9) corresponding to the direction of joystick id (1 or 2).
joystick_check_button(id,numb) Returns whether the joystick button is pressed (numb in the range 1-32).
joystick_xpos(id) Returns the position (-1 to 1) of the x-axis of joystick id.
joystick_ypos(id) Returns the joysticks y-position.
joystick_zpos(id) Returns the joysticks z-position (if it has a z-axis).
joystick_rpos(id) Returns the joysticks rudder position (or fourth axis).
joystick_upos(id) Returns the joysticks u-position (or fifth axis).
joystick_vpos(id) Returns the joysticks v-position (or sixth axis).
joystick_pov(id) Returns the joysticks point-of view position. This is an angle between 0 and 360 degrees. 0 is forwards, 90 to the right, 180 backwards and 270 to the left. When no point-of-view direction is pressed by the user -1 is returned.