class flixel.addons.plugin.control.FlxControl extends FlxPlugin

Available on all platforms

FlxControl * * @link http://www.photonstorm.com * @author Richard Davey / Photon Storm

Class Fields

static function clear():Void

Removes all FlxControlHandlers. * This is called automatically if this plugin is ever destroyed.

static function create(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. * *

Sprite

The FlxSprite you want this class to control. It can only control one FlxSprite at once. *

MovementType

Set to either MOVEMENTINSTANT or MOVEMENTACCELERATES *

StoppingType

Set to STOPPINGINSTANT, STOPPINGDECELERATES or STOPPING_NEVER *

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

static function remove(ControlHandler:FlxControlHandler):Bool

Removes a FlxControlHandler * *

ControlHandler

The FlxControlHandler to delete *

returns

Boolean true if the FlxControlHandler was removed, otherwise false.

static function start(?ControlHandler:FlxControlHandler = null):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(). * *

ControlHandler

The FlxControlHandler to start updating on. If left as null it will start updating all handlers.

static function stop(?ControlHandler:FlxControlHandler = null):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). * *

ControlHandler

The FlxControlHandler to stop updating. If left as null it will stop updating all handlers.

Instance Fields

function new():Void

function destroy():Void

Runs when this plugin is destroyed

function update():Void

Runs update on all currently active FlxControlHandlers