Skip to content
ClassGame Objects & Sprites@public

FlxObject

Authoritative world-space motion and collision object.

ts
export declare class FlxObject extends FlxBasic

Constructors

ts
constructor(x?: number, y?: number, width?: number, height?: number)

Constructs a new instance of the FlxObject class

ParameterTypeDescription
xnumber-
ynumber-
widthnumber-
heightnumber-

Properties

PropertyModifiersTypeDescription
acceleration-FlxPoint-
allowCollisions-number-
angle-number-
angularAcceleration-number-
angularDrag-number-
angularVelocity-number-
ANYstatic readonlynumber-
CEILINGstatic readonly``-
DOWNstatic readonly``-
drag-FlxPoint-
elasticity-number-
flickeringreadonlyboolean-
FLOORstatic readonly``-
health-number-
height-number-
immovable-boolean-
last-FlxPoint-
LEFTstatic readonly``-
mass-number-
maxAngular-number-
maxVelocity-FlxPoint-
moves-boolean-
NONEstatic readonly``-
OVERLAP_BIASstatic readonly``-
PATH_BACKWARDstatic readonly``-
PATH_FORWARDstatic readonly``-
PATH_HORIZONTAL_ONLYstatic readonly``-
PATH_LOOP_BACKWARDstatic readonly``-
PATH_LOOP_FORWARDstatic readonly``-
PATH_VERTICAL_ONLYstatic readonly``-
PATH_YOYOstatic readonly``-
path-FlxPath | null-
pathAngle-number-
pathSpeed-number-
RIGHTstatic readonly``-
scrollFactor-FlxPoint-
solid-boolean-
touching-number-
UPstatic readonly``-
velocity-FlxPoint-
WALLstatic readonlynumber-
wasTouching-number-
width-number-
x-number-
y-number-

Methods

destroy()

ts
destroy(): void

Returns: void

flicker()

ts
flicker(duration?: number): void

Parameters:

ParameterTypeDescription
durationnumber-

Returns: void

followPath()

ts
followPath(path: FlxPath, speed?: number, mode?: number, autoRotate?: boolean): void

Parameters:

ParameterTypeDescription
pathFlxPath-
speednumber-
modenumber-
autoRotateboolean-

Returns: void

getMidpoint()

ts
getMidpoint(point?: FlxPoint): FlxPoint

Parameters:

ParameterTypeDescription
pointFlxPoint-

Returns: FlxPoint

getScreenXY()

ts
getScreenXY(point?: FlxPoint, camera?: FlxCameraLike): FlxPoint

Parameters:

ParameterTypeDescription
pointFlxPoint-
cameraFlxCameraLike-

Returns: FlxPoint

hurt()

ts
hurt(damage: number): void

Parameters:

ParameterTypeDescription
damagenumber-

Returns: void

isTouching()

ts
isTouching(direction: number): boolean

Parameters:

ParameterTypeDescription
directionnumber-

Returns: boolean

justTouched()

ts
justTouched(direction: number): boolean

Parameters:

ParameterTypeDescription
directionnumber-

Returns: boolean

onScreen()

ts
onScreen(camera?: FlxCameraLike): boolean

Parameters:

ParameterTypeDescription
cameraFlxCameraLike-

Returns: boolean

overlaps()

ts
overlaps(objectOrGroup: FlxBasic): boolean

Parameters:

ParameterTypeDescription
objectOrGroupFlxBasic-

Returns: boolean

overlapsAt()

ts
overlapsAt(x: number, y: number, objectOrGroup: FlxBasic): boolean

Parameters:

ParameterTypeDescription
xnumber-
ynumber-
objectOrGroupFlxBasic-

Returns: boolean

overlapsPoint()

ts
overlapsPoint(point: Readonly<FlxPoint>): boolean

Parameters:

ParameterTypeDescription
pointReadonly<FlxPoint>-

Returns: boolean

postUpdate()

ts
postUpdate(): void

Returns: void

preUpdate()

ts
preUpdate(): void

Returns: void

reset()

ts
reset(x: number, y: number): void

Parameters:

ParameterTypeDescription
xnumber-
ynumber-

Returns: void

static separate()

ts
static separate(first: FlxObject, second: FlxObject): boolean

Parameters:

ParameterTypeDescription
firstFlxObject-
secondFlxObject-

Returns: boolean

static separateX()

ts
static separateX(first: FlxObject, second: FlxObject): boolean

Parameters:

ParameterTypeDescription
firstFlxObject-
secondFlxObject-

Returns: boolean

static separateY()

ts
static separateY(first: FlxObject, second: FlxObject): boolean

Parameters:

ParameterTypeDescription
firstFlxObject-
secondFlxObject-

Returns: boolean

stopFollowingPath()

ts
stopFollowingPath(destroyPath?: boolean): void

Parameters:

ParameterTypeDescription
destroyPathboolean-

Returns: void

Released under the MIT License.