You can use this function to get the value of the different axes from a given gamepad slot. You supply the gamepad slot index to check, along with either an axis index constant (as listed here), or an integer value between 0 and gamepad_axis_count() -1. The return value will be between -1 and 1 for each of the available horizontal and vertical axes.


gamepad_axis_value(device, axisIndex);

Argument Description
device Which gamepad device "slot" to check.
axisIndex The axis index to check (see the constants list).




var haxis = gamepad_axis_value(0, gp_axislh);
var vaxis = gamepad_axis_value(0, gp_axislv);
direction = point_direction(0, 0, haxis, vaxis);
speed = point_distance(0 ,0, haxis, vaxis) * 5;

The above code sets the speed and direction of the instance based on the returned values of the left analogue controller of the gamepad plugged into device "slot" 0.