Difference between revisions of "Key.axis"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
<c>[[key]].axis</c> returns the numeric value (from -1 to 1) of an input axis (for example, a joystick horizontal or vertical axis). | <c>[[key]].axis</c> returns the numeric value (from -1 to 1) of an input axis (for example, a joystick horizontal or vertical axis). | ||
− | See also: [[key.pressed]] | + | See also: [[key.pressed]]; [[How to move a sprite with directional inputs]] |
=== Arguments === | === Arguments === |
Revision as of 15:12, 10 April 2020
key.axis
returns the numeric value (from -1 to 1) of an input axis (for example, a joystick horizontal or vertical axis).
See also: key.pressed; How to move a sprite with directional inputs
Arguments
Parameter Name | Type | Default Value | Meaning |
---|---|---|---|
axisName | string | Horizontal | name of axis to get |
Usage Notes
Available axis names are:
- "Horizontal" and "Vertical", which can be activated by both WASD and arrow keys as well as any joystick or gamepad
- "JoyAxis1" through "JoyAxis29" which detect axis inputs from any joystick or gamepad
- "Joy1Axis1" through "Joy8Axis29" which detect axis inputs from specific joystick/gamepad 1 through 8.
Example
print key.axis("Vertical")