FlxMouseControl

@link http://www.photonstorm.com

Static variables

@:value(-1)staticinlineread onlyASCENDING:Int = -1

Use with sort() to sort in ascending order.

@:value(1)staticinlineread onlyDESCENDING:Int = 1

Use with sort() to sort in descending order.

staticdragTarget:FlxExtendedMouseSprite

The FlxExtendedMouseSprite that is currently being dragged, if any.

@:value(false)staticisDragging:Bool = false

Is the mouse currently dragging a sprite? If you have just clicked but NOT yet moved the mouse then this might return false.

@:value(false)staticlinkToDeadZone:Bool = false

Instead of using a mouseZone (which is calculated in world coordinates) you can limit the mouse to the FlxG.camera.deadzone area instead. If set to true the mouse will use the camera deadzone. If false (or the deadzone is null) no check will take place. Note that this takes priority over the mouseZone above. If the mouseZone and deadzone are set, the deadzone is used.

staticmouseZone:FlxRect

The mouse can be set to only be active within a specific FlxRect region of the game world. If outside this FlxRect no clicks, drags or throws will be processed. If the mouse leaves this region while still dragging then the sprite is automatically dropped and its release handler is called. Set the FlxRect to null to disable the zone.

@:value("y")staticsortIndex:String = "y"

The value that the FlxExtendedMouseSprites are sorted by before deciding which is "on-top" for click select

@:value(ASCENDING)staticsortOrder:Int = ASCENDING

The sorting order. If the sortIndex is "y" and the order is ASCENDING then a sprite with a Y value of 200 would be "on-top" of one with a Y value of 100.

staticspeedX:Int

The speed the mouse is moving on the X axis in pixels per frame

staticspeedY:Int

The speed the mouse is moving on the Y axis in pixels per frame

Static methods

staticaddToStack(Item:FlxExtendedMouseSprite):Void

Adds the given FlxExtendedMouseSprite to the stack of potential sprites that were clicked, the stack is then sorted and the final sprite is selected from that

Parameters:

Item

The FlxExtendedMouseSprite that was clicked by the mouse

staticclear():Void

Removes all references to any click / drag targets and resets this class

Constructor

new()

Methods

destroy():Void

Runs when this plugin is destroyed

update(elapsed:Float):Void

Main Update Loop - checks mouse status and updates FlxExtendedMouseSprites accordingly

Inherited Variables

Defined by FlxBasic

@:value(idEnumerator++)ID:Int = idEnumerator++

A unique ID starting from 0 and increasing by 1 for each subsequent FlxBasic that is created.

@:value(true)active:Bool = true

Controls whether update() is automatically called by FlxState/FlxGroup.

@:value(true)alive:Bool = true

Useful state for many game objects - "dead" (!alive) vs alive. kill() and revive() both flip this switch (along with exists, but you can override that).

camera:FlxCamera

Gets or sets the first camera of this object.

cameras:Array<FlxCamera>

This determines on which FlxCameras this object will be drawn. If it is null / has not been set, it uses the list of default draw targets, which is controlled via FlxG.camera.setDefaultDrawTarget as well as the DefaultDrawTarget argument of FlxG.camera.add.

read onlycontainer:Null<FlxContainer>

The parent containing this basic, typically if you check this recursively you should reach the state

Available since

5.7.0

.

@:value(true)exists:Bool = true

Controls whether update() and draw() are automatically called by FlxState/FlxGroup.

@:value(true)visible:Bool = true

Controls whether draw() is automatically called by FlxState/FlxGroup.

Inherited Methods

Defined by FlxBasic

draw():Void

Override this function to control how the object is drawn. Doing so is rarely necessary, but can be very useful.

getCameras():Array<FlxCamera>

The cameras that will draw this. Use this.cameras to set specific cameras for this object, otherwise the container's cameras are used, or the container's container and so on. If there is no container, say, if this is inside FlxGroups rather than a FlxContainer then the default draw cameras are returned.

Available since

5.7.0

.

kill():Void

Handy function for "killing" game objects. Use reset() to revive them. Default behavior is to flag them as nonexistent AND dead. However, if you want the "corpse" to remain in the game, like to animate an effect or whatever, you should override this, setting only alive to false, and leaving exists true.

revive():Void

Handy function for bringing game objects "back to life". Just sets alive and exists back to true. In practice, this function is most often called by FlxObject#reset().