FlxControl
@link http://www.photonstorm.com
Static variables
Static methods
staticclear():Void
Removes all FlxControlHandlers. This is called automatically if this plugin is ever destroyed.
staticcreate(Sprite:FlxSprite, MovementType:Int, StoppingType:Int, Player:Int = 1, UpdateFacing:Bool = false, EnableArrowKeys:Bool = true):FlxControlHandler
Creates a new FlxControlHandler. You can have as many FlxControlHandlers as you like, but you usually only have one per player. The first handler you make will be assigned to the FlxControl.player1 var. The 2nd to FlxControl.player2 and so on for player3 and player4. Beyond this you need to keep a reference to the handler yourself.
Parameters:
Sprite | The FlxSprite you want this class to control. It can only control one FlxSprite at once. |
---|---|
MovementType | Set to either MOVEMENT_INSTANT or MOVEMENT_ACCELERATES |
StoppingType | Set to STOPPING_INSTANT, STOPPING_DECELERATES or STOPPING_NEVER |
Player | An optional ID for the player using these controls; using an ID of 1-4 will allow quick reference via |
UpdateFacing | If true it sets the FlxSprite.facing value to the direction pressed (default false) |
EnableArrowKeys | If true it will enable all arrow keys (default) - see setCursorControl for more fine-grained control |
Returns:
The new FlxControlHandler
staticremove(ControlHandler:FlxControlHandler):Bool
Removes a FlxControlHandler
Parameters:
ControlHandler | The FlxControlHandler to delete |
---|
Returns:
True if the FlxControlHandler was removed, otherwise false.
staticstart(?ControlHandler:FlxControlHandler):Void
Starts updating the given FlxControlHandler, enabling keyboard actions for it. If no FlxControlHandler is given it starts updating all FlxControlHandlers currently added. Updating is enabled by default, but this can be used to re-start it if you have stopped it via stop().
Parameters:
ControlHandler | The FlxControlHandler to start updating on. If left as null it will start updating all handlers. |
---|
staticstop(?ControlHandler:FlxControlHandler):Void
Stops updating the given FlxControlHandler. If no FlxControlHandler is given it stops updating all FlxControlHandlers currently added. Updating is enabled by default, but this can be used to stop it, for example if you paused your game (see start() to restart it again).
Parameters:
ControlHandler | The FlxControlHandler to stop updating. If left as null it will stop updating all handlers. |
---|