Gamepad Actions Library

Gamepad Actions

GameMaker Studio 2 has a number of dedicated actions that can be used to detect both analogue and digital controls from multiple connected game pads. These actions require you to specify a gamepad index value, which is a number (counting from 0) that represents the gamepad being selected. Note that when a gamepad is plugged in to your device (or it is removed) then an asynchronous System Event is triggered (however to deal with this you may need to use code).

游戏手柄 “插槽” 从 0 开始索引,插槽 0 - 3 包含 仅用于 Xinput 游戏手柄,即:Xbox360 控制器和兼容机。However you can also check slots 4 - ii inclusive for DirectInput gamepads, which means you can detect many other models of controller when connected through these slots.

The available gamepad actions are all listed below:

Get Gamepad Axis Value Gamepad Get Axis
Get Gamepad Trigger Value Gamepad Get Trigger
Get Gamepad Count Value Gamepad Get Count
Get Connected Trigger Value Gamepad Get Connected
设置游戏手柄轴的死区(Deadzone) Gamepad Set Axis Deadzone
Check Button 如果手柄按钮按下
Detect Button Down 如果手柄按钮压住
Detect Button Release 如果手柄按钮松开