**This is an old revision of the document!**

WIP by Bouh
Cette page parle d'extension, pour en savoir plus à ce sujet il est recommander de lire cette page

Gamepads (controllers) extension

Cette extension ajoute la prise en charge des manettes de jeu (ou d'autres contrôleurs) à votre jeu, en donnant accès à des informations telles que la pression des gâchettes, des boutons, la position des axes, etc…

Jusqu'à 4 manettes peuvent être connectés : pour chaque condition ou expression, vous devrez entrer le numéro de la manettes avec un numéro 1, 2, 3 ou 4, les paramètres sont détaillé plus bas.

Les manettes de type Xbox360 et PS4 sont pleinement supporté, d'autres types peuvent être aussi utilisé. Mais les boutons peuvent avoir une autre disposition.

Expressions

Function Description
Gamepads::TriggerPressure(a, b) Get the value of the pressure on a gamepad trigger
Gamepads::AxisValue(a, c, d) Get the value of axis of a gamepad stick
Gamepads::LastButtonId(a) Return the index of the last button used on a gamepad
Gamepads::Deadzone() Return the value of the deadzone applied to sticks
Gamepads::ConnectedGamepadsCount() Return the number of connected gamepads
Gamepads::GamepadType(a) Return a string containing information about the specified gamepad

Conditions

Condition Description Argument
Gamepad button pressed Test if a button is pressed on a gamepad a, e
Gamepad stick pushed in a direction (axis) Check if a stick of a gamepad is pushed in a given direction a, c, d
Gamepad type/information Check if the specified gamepad has the specified information in its description. a, f
Gamepad connected Check if a gamepad is connected a

Actions

Action Description Argument
Set gamepad deadzone for sticks Set the deadzone for sticks of the gamepad. The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved). Deadzone is between 0 and 1, and is by default 0.2. g
Vibrate gamepad Generate a vibration on the specified controller. Might only work if the game is running in a recent web browser. a, h

a: Controller ID (1,2,3 or 4)

b: Trigger (“LT”, “RT”, “L2”, “R2”)

c: Stick (“LEFT” or “RIGHT”)

d: Direction (“UP”, “DOWN”, “LEFT” or “RIGHT”)

e: The name of the button can be:

Xbox: “A”, “B”, “X”, “Y”, “LB”, “RB”, “LT”, “RT”, “BACK”, “START”

PS4: "CROSS", "SQUARE", "CIRCLE", "TRIANGLE", "L1", "L2", "R1", "R2", "SHARE", "OPTIONS", "PS_BUTTON", "CLICK_TOUCHPAD"

Other: "UP", "DOWN", "LEFT", "RIGHT", "CLICK_STICK_LEFT", "CLICK_STICK_RIGHT"

f: “Xbox”, “PS4”, “STEAM” or “PS3” (among other)

g: Deadzone for sticks, 0.2 by default

h: Time of the vibration, in seconds (optional, default value is 1)