A FlxPoint that calls a function when set_x(), set_y() or set() is called. Used in FlxSpriteGroup. IMPORTANT: Calling set(x, y); is MUCH FASTER than setting x and y separately. Needs to be destroyed unlike simple FlxPoints!

Constructor

new(setXCallback:FlxPoint‑>Void, ?setYCallback:FlxPoint‑>Void, ?setXYCallback:FlxPoint‑>Void)

If you only specify one callback function, then the remaining two will use the same.

Parameters:

setXCallback

Callback for set_x()

setYCallback

Callback for set_y()

setXYCallback

Callback for set()

Methods

Inherited Variables

Defined by FlxPoint

@:value(0)x:Float = 0

@:value(0)y:Float = 0

Inherited Methods

Defined by FlxPoint

@:value({ Y : 0, X : 0 })inlineadd(X:Float = 0, Y:Float = 0):FlxPoint

Adds to the coordinates of this point.

Parameters:

X

Amount to add to x

Y

Amount to add to y

Returns:

This point.

addPoint(point:FlxPoint):FlxPoint

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

Parameters:

point

The point to add to this point

Returns:

This point.

inlineaddToFlash(FlashPoint:Point):Point

Helper function, just increases the values of the specified Flash point by the values of this point.

Parameters:

Point

Any Point.

Returns:

A reference to the altered point parameter.

angleBetween(point:FlxPoint):Float

Calculates the angle between this and another point. 0 degrees points straight up.

Parameters:

point

The other point.

Returns:

The angle in degrees, between -180 and 180.

inlineceil():FlxPoint

Rounds x and y using Math.ceil()

inlinecopyFrom(point:FlxPoint):FlxPoint

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

Parameters:

point

Any FlxPoint.

Returns:

A reference to itself.

inlinecopyFromFlash(FlashPoint:Point):FlxPoint

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

Parameters:

Point

Any Point.

Returns:

A reference to itself.

copyTo(?point:FlxPoint):FlxPoint

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

Parameters:

Point

Any FlxPoint.

Returns:

A reference to the altered point parameter.

inlinecopyToFlash(FlashPoint:Point):Point

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

Parameters:

Point

Any Point.

Returns:

A reference to the altered point parameter.

distanceTo(point:FlxPoint):Float

Calculate the distance to another point.

Parameters:

AnotherPoint

A FlxPoint object to calculate the distance to.

Returns:

The distance between the two points as a Float.

inlineequals(point:FlxPoint):Bool

Function to compare this FlxPoint to another.

Parameters:

point

The other FlxPoint to compare to this one.

Returns:

True if the FlxPoints have the same x and y value, false otherwise.

inlinefloor():FlxPoint

Rounds x and y using Math.floor()

inlineinCoords(RectX:Float, RectY:Float, RectWidth:Float, RectHeight:Float):Bool

Returns true if this point is within the given rectangular block

Parameters:

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

inlineinRect(Rect:FlxRect):Bool

Returns true if this point is within the given rectangular block

Parameters:

Rect

The FlxRect to test within

Returns:

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

inlineputWeak():Void

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

rotate(Pivot:FlxPoint, Angle:Float):FlxPoint

Rotates this point clockwise in 2D space around another point by the given angle.

Parameters:

Pivot

The pivot you want to rotate this point around

Angle

Rotate the point by this many degrees clockwise.

Returns:

A FlxPoint containing the coordinates of the rotated point.

inlineround():FlxPoint

Rounds x and y using Math.round()

scale(k:Float):FlxPoint

Scale this point.

Parameters:

k
  • scale coefficient

Returns:

scaled point

Available since

4.1.0

.

@:value({ Y : 0, X : 0 })inlinesubtract(X:Float = 0, Y:Float = 0):FlxPoint

Subtracts from the coordinates of this point.

Parameters:

X

Amount to subtract from x

Y

Amount to subtract from y

Returns:

This point.

inlinesubtractFromFlash(FlashPoint:Point):Point

Helper function, just decreases the values of the specified Flash point by the values of this point.

Parameters:

Point

Any Point.

Returns:

A reference to the altered point parameter.

subtractPoint(point:FlxPoint):FlxPoint

Subtracts the coordinates of another point from the coordinates of this point.

Parameters:

point

The point to subtract from this point

Returns:

This point.

inlinetoString():String

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

inlinetoVector():FlxVector

Function to get a FlxVector from this FlxPoint

Available since

4.3.0

.

inlinetransform(matrix:Matrix):FlxPoint

Applies transformation matrix to this point

Parameters:

matrix

transformation matrix

Returns:

transformed point