Game controllers
Mini Micro supports up to eight game controllers (gamepads or joysticks) via the key module.
The fastest way to identify what a particular button or axis input is called is often to run the /sys/demo/inputCheck.ms
script that comes with Mini Micro, and then press or wiggle the input of interest. The name or names of that control will be displayed on the screen.
Reading Game Controller Buttons
Buttons on any (unspecified) game controller are identified as "joystick button 0"
, "joystick button 1"
, etc., through "joystick button 15"
. Or, you can read buttons on a specific game controller (numbered 1 through 8) as "joystick 1 button 0"
, "joystick 1 button 0"
, etc.
Read these with key.pressed
, which will return 1 (true) if the button is pressed, and 0 (false) otherwise.
Reading Game Controller Axes
An "axis" is some directional input, like a joystick, d-pad, or trigger. These are read with key.axis
, which returns a value from -1 to 1 (or from 0 to 1 for some axes). Mini Micro supports two special axes, "Horizontal"
and "Vertical"
, which can be activated by the user using the WASD keys, or the arrow keys, or the primary joystick or d-pad on most game controllers.
In addition, axes of any (unspecified) game controller are identified as "JoyAxis1"
, "JoyAxis2"
, etc. through "JoyAxis29"
. Or, you can read an axis on a specific game controller (numbered 1 through 8) as "Joy1Axis1"
, "Joy1Axis2"
, etc.
Note that for historical reasons, the numbering of axes (1 through 29) differs from the numbering of buttons (0 through 15), as does the capitalization and spacing. But follow the patterns presented above and you'll be fine.