joystick_exists

Checks for a joystick.

Syntax:

joystick_exists(id);


Argument Description
id The id of the joystick to check for (1 or 2).


Returns: Boolean


Description

This function will return true if a joystick/gamepad with the given id is connected or false if it is not. The id can be either 1 or 2 as GameMaker: Studio only accepts input from a maximum of two joysticks/gamepads.

NOTE: This function is only available for Windows.


Example:

if joystick_exists(1) || joystick_exists(2)
   {
   global.Control = 3;
   }

The above code checks to see if a joystick or gamepad is connected to the device and, if so, sets a global variable.


Back: Joystick Input
Next: joystick_name
© Copyright YoYo Games Ltd. 2018 All Rights Reserved