class flixel.util.FlxPoint implements IFlxPooled

Available on all platforms

Stores a 2D floating point coordinate.

Class Fields

static function get(?X:Float = 0, ?Y:Float = 0):FlxPoint

Recycle or create a new FlxPoint. * Be sure to put() them back into the pool after you're done with them! * *

X

The X-coordinate of the point in space. *

Y

The Y-coordinate of the point in space. *

returns

This point.

static function weak(?X:Float = 0, ?Y:Float = 0):FlxPoint

Recycle or create a new FlxPoint which will automatically be released * to the pool when passed into a flixel function. * *

X

The X-coordinate of the point in space. *

Y

The Y-coordinate of the point in space. *

returns

This point.

Instance Fields

var x:Float

var y:Float

function new(?X:Float = 0, ?Y:Float = 0):Void

function add(?X:Float = 0, ?Y:Float = 0):FlxPoint

Adds the to the coordinates of this point. * *

X

Amount to add to x *

Y

Amount to add to y *

returns

This point.

function addPoint(point:FlxPoint):FlxPoint

Adds the coordinates of another point to the coordinates of this point. * *

point

The point to add to this point *

returns

This point.

function ceil():FlxPoint

Rounds x and y using Math.ceil()

function copyFrom(point:FlxPoint):FlxPoint

Helper function, just copies the values from the specified point. * *

point

Any FlxPoint. *

returns

A reference to itself.

function copyFromFlash(FlashPoint:Point):FlxPoint

Helper function, just copies the values from the specified Flash point. * *

Point

Any Point. *

returns

A reference to itself.

function copyTo(?point:FlxPoint = null):FlxPoint

Helper function, just copies the values from this point to the specified point. * *

Point

Any FlxPoint. *

returns

A reference to the altered point parameter.

function copyToFlash(FlashPoint:Point):Point

Helper function, just copies the values from this point to the specified Flash point. * *

Point

Any Point. *

returns

A reference to the altered point parameter.

function destroy():Void

Necessary for IFlxDestroyable.

function distanceTo(AnotherPoint:FlxPoint):Float

Calculate the distance to another point. * *

AnotherPoint

A FlxPoint object to calculate the distance to. *

returns

The distance between the two points as a Float.

function floor():FlxPoint

Rounds x and y using Math.floor()

function inCoords(RectX:Float, RectY:Float, RectWidth:Float, RectHeight:Float):Bool

Returns true if this point is within the given rectangular block * *

RectX

The X value of the region to test within *

RectY

The Y value of the region to test within *

RectWidth

The width of the region to test within *

RectHeight

The height of the region to test within *

returns

True if the point is within the region, otherwise false

function inFlxRect(Rect:FlxRect):Bool

Returns true if this point is within the given rectangular block * *

Rect

The FlxRect to test within *

returns

True if pointX/pointY is within the FlxRect, otherwise false

function put():Void

Add this FlxPoint to the recycling pool.

function putWeak():Void

Add this FlxPoint to the recycling pool if it's a weak reference (allocated via weak()).

function set(?X:Float = 0, ?Y:Float = 0):FlxPoint

Set the coordinates of this point. * *

X

The X-coordinate of the point in space. *

Y

The Y-coordinate of the point in space. *

returns

This point.

function subtract(?X:Float = 0, ?Y:Float = 0):FlxPoint

Adds the to the coordinates of this point. * *

X

Amount to subtract from x *

Y

Amount to subtract from y *

returns

This point.

function subtractPoint(point:FlxPoint):FlxPoint

Adds the coordinates of another point to the coordinates of this point. * *

point

The point to subtract from this point *

returns

This point.

function toString():String

Convert object to readable string name. Useful for debugging, save games, etc.