Stores a 2D floating point coordinate.

Constructor

new(X:Float = 0, Y:Float = 0)

Variables

x:Float = 0

y:Float = 0

Methods

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.

destroy():Void

Necessary for IFlxDestroyable.

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

put():Void

Add this FlxPoint to the recycling pool.

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

.

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

Set the coordinates of this point.

Parameters:

X

The X-coordinate of the point in space.

Y

The Y-coordinate of the point in space.

Returns:

This point.

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

Static variables

staticread onlypool:IFlxPool<FlxPoint>

Static methods

staticinlineget(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!

Parameters:

X

The X-coordinate of the point in space.

Y

The Y-coordinate of the point in space.

Returns:

This point.

staticinlineweak(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.

Parameters:

X

The X-coordinate of the point in space.

Y

The Y-coordinate of the point in space.

Returns:

This point.