Gamepad Support


PaC-DK is able to support gamepads as input since 3.1.

Mousecontrol via Gamepad :

In the project setup you can enable that the player can use a gamepad to control the mousecursor. The first two buttons of the gamepad will be used as mousebutton "left" and "right".

Reading D-Pad and Buttons :

To read the status of the D-Pad and all buttons you can use the scriptcommands if_paddown and if_padpressed . This works exactly like checking for keyboard strokes. You can use 2 gamepads max.

Important: For minigames ect gamepad supprt should always be optional. Make sure you can also use the keyboard for your minigames.

Reading all axes :

To read the position of all axes of a gamepad you can use some new predefined variables, example :

setnum (XAxis ; [gamepadX:1])

This will write the current position of the X Axis of Gamepad 1 to the Var  XAxis . Possible values are -1000 to 1000. You must handle a deadzone by yourself. 200 is recommended.
Possible axes are the left stick (X /Y) the right stick (U /R) and the analog shoulder buttons (Z).

There is a complete demo project for gamepad support for download on the PaC-DK Homepage, see in "Examples".

Advanced gamepad support :

When you make use of the gamepad -> mouse option you should also use some additional buttons of the gamepad. For example for opening the menu or the inventory. You can achieve this by using the mainscript or a function that constantly checks for thos gamepad buttons.