class FlxActionAnalog
package flixel.input.actions
extends FlxAction
import flixel.input.actions.FlxAction
Analog actions are events with continuous (floating-point) values, and up to two axes (x,y). This is for events like "move" and "accelerate" where the event is not simply on or off.
FlxActions let you attach multiple inputs to a single in-game action, so "move" could be performed by a gamepad joystick, a mouse movement, etc.
4.6.0
.Constructor
new(Name:String = "", ?Callback:FlxActionAnalog ‑> Void)
Create a new analog action
Parameters:
Name | name of the action |
---|---|
Callback | function to call when this action occurs |
Variables
Methods
addGamepad(InputID:FlxGamepadInputID, Trigger:FlxAnalogState, Axis:FlxAnalogAxis = EITHER, GamepadID:Int = FlxInputDeviceID.FIRST_ACTIVE):FlxActionAnalog
Add gamepad action input for analog (trigger, joystick, touchpad, etc) events
Parameters:
InputID | "universal" gamepad input ID (LEFT_TRIGGER, RIGHT_ANALOG_STICK, TILT_PITCH, etc) |
---|---|
Trigger | What state triggers this action (MOVED, JUST_MOVED, STOPPED, JUST_STOPPED) |
Axis | which axes to monitor for triggering: X, Y, EITHER, or BOTH |
GamepadID | specific gamepad ID, or FlxInputDeviceID.FIRST_ACTIVE / ALL |
Returns:
This action
addMouseClickAndDragMotion(ButtonID:FlxMouseButtonID, Trigger:FlxAnalogState, Axis:FlxAnalogAxis = FlxAnalogAxis.EITHER, PixelsPerUnit:Int = 10, DeadZone:Float = 0.1, InvertY:Bool = false, InvertX:Bool = false):FlxActionAnalog
Add mouse input -- same as mouse motion, but requires a particular mouse button to be PRESSED Very useful for e.g. panning a map or canvas around
Parameters:
ButtonID | Button identifier (FlxMouseButtonID.LEFT / MIDDLE / RIGHT) |
---|---|
Trigger | What state triggers this action (MOVED, JUST_MOVED, STOPPED, JUST_STOPPED) |
Axis | which axes to monitor for triggering: X, Y, EITHER, or BOTH |
PixelsPerUnit | How many pixels of movement = 1.0 in analog motion (lower: more sensitive, higher: less sensitive) |
DeadZone | Minimum analog value before motion will be reported |
InvertY | Invert the Y axis |
InvertX | Invert the X axis |
Returns:
This action
addMouseMotion(Trigger:FlxAnalogState, Axis:FlxAnalogAxis = EITHER, PixelsPerUnit:Int = 10, DeadZone:Float = 0.1, InvertY:Bool = false, InvertX:Bool = false):FlxActionAnalog
Add mouse input -- X/Y is the RELATIVE motion of the mouse since the last frame
Parameters:
Trigger | What state triggers this action (MOVED, JUST_MOVED, STOPPED, JUST_STOPPED) |
---|---|
Axis | which axes to monitor for triggering: X, Y, EITHER, or BOTH |
PixelsPerUnit | How many pixels of movement = 1.0 in analog motion (lower: more sensitive, higher: less sensitive) |
DeadZone | Minimum analog value before motion will be reported |
InvertY | Invert the Y axis |
InvertX | Invert the X axis |
Returns:
This action
addMousePosition(Trigger:FlxAnalogState, Axis:FlxAnalogAxis = EITHER):FlxActionAnalog
Add mouse input -- X/Y is the mouse's absolute screen position
Parameters:
Trigger | What state triggers this action (MOVED, JUST_MOVED, STOPPED, JUST_STOPPED) |
---|---|
Axis | which axes to monitor for triggering: X, Y, EITHER, or BOTH |
Returns:
This action