Static variables

@:value("click_check_box")staticinlineread onlyCLICK_EVENT:String = "click_check_box"

Constructor

@:value({ LabelW : 100, Y : 0, X : 0 })new(X:Float = 0, Y:Float = 0, ?Box:Dynamic, ?Check:Dynamic, ?Label:String, LabelW:Int = 100, ?Params:Array<Dynamic>, ?Callback:() ‑> Void)

Variables

@:value(2)box_space:Float = 2

@:value(false)checkbox_dirty:Bool = false

@:value(false)checked:Bool = false

@:value(-1)max_width:Float = -1

@:value(false)skipButtonUpdate:Bool = false

@:value(true)textIsClickable:Bool = true

@:value(0)textX:Float = 0

@:value(0)textY:Float = 0

callback:() ‑> Void

Methods

Inherited Variables

Defined by FlxTypedUIGroup

@:value(true)autoBounds:Bool = true

Will automatically adjust the width and height to the members, on add/remove calls

@:value(true)broadcastToFlxUI:Bool = true

If true, will issue FlxUI.event() and FlxUI.request() calls

name:String

a handy string handler name for this thing

Defined by FlxTypedSpriteGroup

@:value(false)directAlpha:Bool = false

Whether to attempt to preserve the ratio of alpha values of group members, or set them directly through the alpha property. Defaults to false (preservation).

Available since

4.5.0

.

group:FlxTypedGroup<T>

The actual group which holds all sprites.

read onlylength:Int

The number of entries in the members array. For performance and safety you should check this variable instead of members.length unless you really know what you're doing!

maxSize:Int

The maximum capacity of this group. Default is 0, meaning no max capacity, and the group can just grow.

read onlymembers:Array<T>

The link to a group's members array.

Defined by FlxSprite

@:value(1.0)alpha:Float = 1.0

Set alpha to a number between 0 and 1 to change the opacity of the sprite.

See also:

animation:FlxAnimationController

Class that handles adding and playing animations on this sprite.

See also:

@:value(defaultAntialiasing)antialiasing:Bool = defaultAntialiasing

Controls whether the object is smoothed when rotated, affects performance.

@:value(0)read onlybakedRotationAngle:Float = 0

The minimum angle (out of 360°) for which a new baked rotation exists. Example: 90 means there are 4 baked rotations in the spritesheet. 0 if this sprite does not have any baked rotations.

See also:

blend:BlendMode

Blending modes, just like Photoshop or whatever, e.g. "multiply", "screen", etc.

clipRect:FlxRect

Clipping rectangle for this sprite. Changing the rect's properties directly doesn't have any effect, reassign the property to update it (sprite.clipRect = sprite.clipRect;). Set to null to discard graphic frame clipping.

@:value(0xffffff)color:FlxColor = 0xffffff

Tints the whole sprite to a color (0xRRGGBB format) - similar to OpenGL vertex colors. You can use 0xAARRGGBB colors, but the alpha value will simply be ignored. To change the opacity use alpha.

See also:

@:value(true)dirty:Bool = true

Set this flag to true to force the sprite to update during the draw() call. NOTE: Rarely if ever necessary, most sprite operations will flip this flag automatically.

@:value(RIGHT)facing:FlxDirectionFlags = RIGHT

Can be set to LEFT, RIGHT, UP, and DOWN to take advantage of flipped sprites and/or just track player orientation more easily.

See also:

@:value(false)flipX:Bool = false

Whether this sprite is flipped on the X axis.

@:value(false)flipY:Bool = false

Whether this sprite is flipped on the Y axis.

frame:FlxFrame

Link to current FlxFrame from loaded atlas

@:value(0)read onlyframeHeight:Int = 0

The height of the actual graphic or image being displayed (not necessarily the game object/bounding box).

framePixels:BitmapData

The current display state of the sprite including current animation frame, tint, flip etc... may be null unless useFramePixels is true.

@:value(0)read onlyframeWidth:Int = 0

The width of the actual graphic or image being displayed (not necessarily the game object/bounding box).

frames:FlxFramesCollection

Rendering variables.

read onlynumFrames:Int

The total number of frames in this image. WARNING: assumes each row in the sprite sheet is full!

read onlyoffset:FlxPoint

The position of the sprite's graphic relative to its hitbox. For example, offset.x = 10; will show the graphic 10 pixels left of the hitbox. Likely needs to be adjusted after changing a sprite's width, height or scale.

read onlyorigin:FlxPoint

WARNING: The origin of the sprite will default to its center. If you change this, the visuals and the collisions will likely be pretty out-of-sync if you do any rotation.

pixels:BitmapData

This sprite's graphic / BitmapData object. Automatically adjusts graphic size and render helpers if changed.

read onlyscale:FlxPoint

Change the size of your sprite's graphic. NOTE: The hitbox is not automatically adjusted, use updateHitbox() for that. WARNING: With FlxG.renderBlit, scaling sprites decreases rendering performance by a factor of about x10!

See also:

shader:FlxShader

GLSL shader for this sprite. Avoid changing it frequently as this is a costly operation.

Available since

4.1.0

.

@:value(false)read onlyuseColorTransform:Bool = false

Whether or not to use a ColorTransform set via setColorTransform().

@:value(true)useFramePixels:Bool = true

Always true on FlxG.renderBlit. On FlxG.renderTile it determines whether framePixels is used and defaults to false for performance reasons.

Defined by FlxObject

read onlyacceleration:FlxPoint

How fast the speed of this object is changing (in pixels per second). Useful for smooth movement and gravity.

@:value(FlxDirectionFlags.ANY)allowCollisions:FlxDirectionFlags = FlxDirectionFlags.ANY

Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating collision directions. Use bitwise operators to check the values stored here. Useful for things like one-way platforms (e.g. allowCollisions = UP;). The accessor "solid" just flips this variable between NONE and ANY.

@:value(0)angle:Float = 0

Set the angle (in degrees) of a sprite to rotate it. WARNING: rotating sprites decreases their rendering performance by a factor of ~10x when using blitting!

@:value(0)angularAcceleration:Float = 0

How fast the spin speed should change (in degrees per second).

@:value(0)angularDrag:Float = 0

Like drag but for spinning.

@:value(0)angularVelocity:Float = 0

This is how fast you want this sprite to spin (in degrees per second).

@:value(IMMOVABLE)collisionXDrag:CollisionDragType = IMMOVABLE

Whether this sprite is dragged along with the horizontal movement of objects it collides with (makes sense for horizontally-moving platforms in platformers for example). Use values IMMOVABLE, ALWAYS, HEAVIER or NEVER

Available since

4.11.0

.

@:value(NEVER)collisionYDrag:CollisionDragType = NEVER

Whether this sprite is dragged along with the vertical movement of objects it collides with (for sticking to vertically-moving platforms in platformers for example). Use values IMMOVABLE, ALWAYS, HEAVIER or NEVER

Available since

4.11.0

.

collisonXDrag:Bool

Deprecated: "Use `collisionXDrag`, instead. Note the corrected spelling: `collis(i)onXDrag"

DEPRECATED Whether this sprite is dragged along with the horizontal movement of objects it collides with (makes sense for horizontally-moving platforms in platformers for example).

Apart from having a weird typo, this has been deprecated for collisionXDrag, which allows more options.

@:value(null)debugBoundingBoxColor:Null<FlxColor> = null

Overriding this will force a specific color to be used for debug rect (ignoring any of the other debug bounding box colors specified).

@:value(FlxColor.BLUE)debugBoundingBoxColorNotSolid:FlxColor = FlxColor.BLUE

Color used for the debug rect if allowCollisions == NONE.

Available since

4.2.0

.

@:value(FlxColor.GREEN)debugBoundingBoxColorPartial:FlxColor = FlxColor.GREEN

Color used for the debug rect if this object collides partially (immovable in the case of FlxObject, or allowCollisions not equal to ANY or NONE in the case of tiles in FlxTilemap).

Available since

4.2.0

.

@:value(FlxColor.RED)debugBoundingBoxColorSolid:FlxColor = FlxColor.RED

Color used for the debug rect if allowCollisions == ANY.

Available since

4.2.0

.

read onlydrag:FlxPoint

This isn't drag exactly, more like deceleration that is only applied when acceleration is not affecting the sprite.

@:value(0)elasticity:Float = 0

The bounciness of this object. Only affects collisions. Default value is 0, or "not bouncy at all."

@:value(1)health:Float = 1

Deprecated: "object.health is being removed in version 6.0.0"

Handy for storing health percentage or armor points or whatever.

@:isVarheight:Float

The height of this object's hitbox. For sprites, use offset to control the hitbox position.

@:value(false)ignoreDrawDebug:Bool = false

Setting this to true will prevent the object's bounding box from appearing when FlxG.debugger.drawDebug is true.

@:value(false)immovable:Bool = false

Whether an object will move/alter position after a collision.

read onlylast:FlxPoint

Important variable for collision processing. By default this value is set automatically during at the start of update().

@:value(1)mass:Float = 1

The virtual mass of the object. Default value is 1. Currently only used with elasticity during collision resolution. Change at your own risk; effects seem crazy unpredictable so far!

@:value(10000)maxAngular:Float = 10000

Use in conjunction with angularAcceleration for fluid spin speed control.

read onlymaxVelocity:FlxPoint

If you are using acceleration, you can use maxVelocity with it to cap the speed automatically (very useful!).

@:value(defaultMoves)moves:Bool = defaultMoves

Set this to false if you want to skip the automatic motion/movement stuff (see updateMotion()). FlxObject and FlxSprite default to true. FlxText, FlxTileblock and FlxTilemap default to false.

@:value(null)path:FlxPath = null

The path this object follows. Not initialized by default. Assign a new FlxPath() object and start() it if you want to this object to follow a path. Set path to null again to stop following the path. See flixel.util.FlxPath for more info and usage examples.

@:value(true)pixelPerfectPosition:Bool = true

Whether or not the position of this object should be rounded before any draw() or collision checking.

pixelPerfectRender:Null<Bool>

Whether or not the coordinates should be rounded during rendering. Does not affect copyPixels(), which can only render on whole pixels. Defaults to the camera's global pixelPerfectRender value, but overrides that value if not equal to null.

read onlyscrollFactor:FlxPoint

Controls how much this object is affected by camera scrolling. 0 = no movement (e.g. a background layer), 1 = same movement speed as the foreground. Default value is (1,1), except for UI elements like FlxButton where it's (0,0).

solid:Bool

Whether the object collides or not. For more control over what directions the object will collide from, use collision constants (like LEFT, FLOOR, etc) to set the value of allowCollisions directly.

@:value(FlxDirectionFlags.NONE)touching:FlxDirectionFlags = FlxDirectionFlags.NONE

Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts. Use bitwise operators to check the values stored here, or use isTouching(), justTouched(), etc. You can even use them broadly as boolean values if you're feeling saucy!

read onlyvelocity:FlxPoint

The basic speed of this object (in pixels per second).

@:value(FlxDirectionFlags.NONE)wasTouching:FlxDirectionFlags = FlxDirectionFlags.NONE

Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts from the previous game loop step. Use bitwise operators to check the values stored here, or use isTouching(), justTouched(), etc. You can even use them broadly as boolean values if you're feeling saucy!

@:isVarwidth:Float

The width of this object's hitbox. For sprites, use offset to control the hitbox position.

@:value(0)x:Float = 0

X position of the upper left corner of this object in world space.

@:value(0)y:Float = 0

Y position of the upper left corner of this object in world space.

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 FlxTypedUIGroup

calcBounds(?rect:FlxRect):Void

Calculates the bounds of the group and sets width/height

Parameters:

rect

If supplied, populates this with the boundaries of the group

contains(sprite:T):Bool

Whether this group contains the sprite.

floorAll():Void

Floor the positions of all children

inlinehasThis(sprite:T):Bool

Deprecated: "Use contains, instead"

Whether this group contains the sprite.

Defined by FlxTypedSpriteContainer

Defined by FlxTypedSpriteGroup

inlineclear():Void

Remove all instances of FlxSprite from the list. WARNING: does not destroy() or kill() any of these objects!

clone():FlxTypedSpriteGroup<T>

Recursive cloning method: it will create a copy of this group which will hold copies of all sprites

Returns:

copy of this sprite group

inlinecountDead():Int

Call this function to find out how many members of the group are dead.

Returns:

The number of FlxSprites flagged as dead. Returns -1 if group is empty.

inlinecountLiving():Int

Call this function to find out how many members of the group are not dead.

Returns:

The number of FlxSprites flagged as not dead. Returns -1 if group is empty.

findMaxX():Float

Returns the right-most position of the right-most member. If there are no members, x is returned.

Available since

5.0.0

.

findMaxY():Float

Returns the top-most position of the top-most member. If there are no members, y is returned.

Available since

5.0.0

.

findMinX():Float

Returns the left-most position of the left-most member. If there are no members, x is returned.

Available since

5.0.0

.

findMinY():Float

Returns the top-most position of the top-most member. If there are no members, y is returned.

Available since

5.0.0

.

@:value({ Recurse : false })inlineforEach(Function:T ‑> Void, Recurse:Bool = false):Void

Applies a function to all members.

Parameters:

Function

A function that modifies one element at a time.

Recurse

Whether or not to apply the function to members of subgroups as well.

@:value({ Recurse : false })inlineforEachAlive(Function:T ‑> Void, Recurse:Bool = false):Void

Applies a function to all alive members.

Parameters:

Function

A function that modifies one element at a time.

Recurse

Whether or not to apply the function to members of subgroups as well.

@:value({ Recurse : false })inlineforEachDead(Function:T ‑> Void, Recurse:Bool = false):Void

Applies a function to all dead members.

Parameters:

Function

A function that modifies one element at a time.

Recurse

Whether or not to apply the function to members of subgroups as well.

@:value({ Recurse : false })inlineforEachExists(Function:T ‑> Void, Recurse:Bool = false):Void

Applies a function to all existing members.

Parameters:

Function

A function that modifies one element at a time.

Recurse

Whether or not to apply the function to members of subgroups as well.

@:value({ Recurse : false })inlineforEachOfType<K>(ObjectClass:Class<K>, Function:K ‑> Void, Recurse:Bool = false):Void

Applies a function to all members of type Class<K>.

Parameters:

ObjectClass

A class that objects will be checked against before Function is applied, ex: FlxSprite.

Function

A function that modifies one element at a time.

Recurse

Whether or not to apply the function to members of subgroups as well.

inlinegetFirstAlive():T

Call this function to retrieve the first object with dead == false in the group. This is handy for checking if everything's wiped out, or choosing a squad leader, etc.

Returns:

A FlxSprite currently flagged as not dead.

@:value({ Force : false })inlinegetFirstAvailable(?ObjectClass:Class<T>, Force:Bool = false):T

Call this function to retrieve the first object with exists == false in the group. This is handy for recycling in general, e.g. respawning enemies.

Parameters:

ObjectClass

An optional parameter that lets you narrow the results to instances of this particular class.

Force

Force the object to be an ObjectClass and not a super class of ObjectClass.

Returns:

A FlxSprite currently flagged as not existing.

inlinegetFirstDead():T

Call this function to retrieve the first object with dead == true in the group. This is handy for checking if everything's wiped out, or choosing a squad leader, etc.

Returns:

A FlxSprite currently flagged as dead.

inlinegetFirstExisting():T

Call this function to retrieve the first object with exists == true in the group. This is handy for checking if everything's wiped out, or choosing a squad leader, etc.

Returns:

A FlxSprite currently flagged as existing.

inlinegetFirstNull():Int

Call this function to retrieve the first index set to null. Returns -1 if no index stores a null object.

Returns:

An Int indicating the first null slot in the group.

@:value({ Length : 0, StartIndex : 0 })inlinegetRandom(StartIndex:Int = 0, Length:Int = 0):T

Returns a member at random from the group.

Parameters:

StartIndex

Optional offset off the front of the array. Default value is 0, or the beginning of the array.

Length

Optional restriction on the number of values you want to randomly select from.

Returns:

A FlxSprite from the members list.

insert(Position:Int, Sprite:T):T

Inserts a new FlxSprite subclass to the group at the specified position.

Parameters:

Position

The position that the new sprite or sprite group should be inserted at.

Sprite

The sprite or sprite group you want to insert into the group.

Returns:

The same object that was passed in.

Available since

4.3.0

.

isOnScreen(?Camera:FlxCamera):Bool

Check and see if any sprite in this group is currently on screen.

Parameters:

Camera

Specify which game camera you want. If null, it will just grab the first global camera.

Returns:

Whether the object is on screen or not.

inlineiterator(?filter:T ‑> Bool):FlxTypedGroupIterator<T>

Iterate through every member

Returns:

An iterator

kill():Void

Calls kill() on the group's members and then on the group itself. You can revive this group later via revive() after this.

@:value({ Unique : false, Height : 0, Width : 0, Animated : false })loadGraphic(Graphic:FlxGraphicAsset, Animated:Bool = false, Width:Int = 0, Height:Int = 0, Unique:Bool = false, ?Key:String):FlxSprite

This functionality isn't supported in SpriteGroup

Returns:

this sprite group

loadGraphicFromSprite(Sprite:FlxSprite):FlxSprite

This functionality isn't supported in SpriteGroup

Returns:

this sprite group

@:value({ AutoBuffer : false, AntiAliasing : false, Frame : -1, Rotations : 16 })loadRotatedGraphic(Graphic:FlxGraphicAsset, Rotations:Int = 16, Frame:Int = -1, AntiAliasing:Bool = false, AutoBuffer:Bool = false, ?Key:String):FlxSprite

This functionality isn't supported in SpriteGroup

Returns:

this sprite group

@:value({ Unique : false, Color : FlxColor.WHITE })makeGraphic(Width:Int, Height:Int, Color:Int = FlxColor.WHITE, Unique:Bool = false, ?Key:String):FlxSprite

This functionality isn't supported in SpriteGroup

Returns:

this sprite group

@:genericmultiTransformChildren<V>(FunctionArray:Array<(T, V) ‑> Void>, ValueArray:Array<V>):Void

Handy function that allows you to quickly transform multiple properties of sprites in this group at a time.

Parameters:

FunctionArray

Array of functions to transform sprites in this group.

ValueArray

Array of values which will be passed to lambda functions

@:value({ InScreenSpace : false })overlapsPoint(point:FlxPoint, InScreenSpace:Bool = false, ?Camera:FlxCamera):Bool

Checks to see if a point in 2D world space overlaps any FlxSprite object from this group.

Parameters:

Point

The point in world space you want to check.

InScreenSpace

Whether to take scroll factors into account when checking for overlap.

Camera

Specify which game camera you want. If null, it will just grab the first global camera.

Returns:

Whether or not the point overlaps this group.

@:value({ Mask : 0xFF })pixelsOverlapPoint(point:FlxPoint, Mask:Int = 0xFF, ?Camera:FlxCamera):Bool

Checks to see if a point in 2D world space overlaps any of FlxSprite object's current displayed pixels. This check is ALWAYS made in screen space, and always takes scroll factors into account.

Parameters:

Point

The point in world space you want to check.

Mask

Used in the pixel hit test to determine what counts as solid.

Camera

Specify which game camera you want. If null, it will just grab the first global camera.

Returns:

Whether or not the point overlaps this object.

@:value({ Revive : true, Force : false })inlinerecycle(?ObjectClass:Class<T>, ?ObjectFactory:() ‑> T, Force:Bool = false, Revive:Bool = true):T

Recycling is designed to help you reuse game objects without always re-allocating or "newing" them. It behaves differently depending on whether maxSize equals 0 or is bigger than 0.

maxSize > 0 / "rotating-recycling" (used by FlxEmitter): - at capacity: returns the next object in line, no matter its properties like alive, exists etc. - otherwise: returns a new object.

maxSize == 0 / "grow-style-recycling" - tries to find the first object with exists == false - otherwise: adds a new object to the members array

WARNING: If this function needs to create a new object, and no object class was provided, it will return null instead of a valid object!

Parameters:

ObjectClass

The class type you want to recycle (e.g. FlxSprite, EvilRobot, etc).

ObjectFactory

Optional factory function to create a new object if there aren't any dead members to recycle. If null, Type.createInstance() is used, which requires the class to have no constructor parameters.

Force

Force the object to be an ObjectClass and not a super class of ObjectClass.

Revive

Whether recycled members should automatically be revived (by calling revive() on them).

Returns:

A reference to the object that was created.

inlinereplace(oldObject:T, newObject:T):T

Replaces an existing FlxSprite with a new one.

Parameters:

oldObject

The sprite you want to replace.

newObject

The new object you want to use instead.

Returns:

The new sprite.

@:value({ FetchPositions : false })replaceColor(Color:Int, NewColor:Int, FetchPositions:Bool = false):Array<FlxPoint>

Replaces all pixels with specified Color with NewColor pixels. WARNING: very expensive (especially on big graphics) as it iterates over every single pixel.

Parameters:

Color

Color to replace

NewColor

New color

FetchPositions

Whether we need to store positions of pixels which colors were replaced.

Returns:

Array with replaced pixels positions

revive():Void

Revives the group.

@:value({ Y : 0, X : 0 })setPosition(X:Float = 0, Y:Float = 0):Void

Helper function to set the coordinates of this object. Handy since it only requires one line of code.

Parameters:

X

The new x position

Y

The new y position

@:value({ Order : FlxSort.ASCENDING })inlinesort(Function:(Int, T, T) ‑> Int, Order:Int = FlxSort.ASCENDING):Void

Call this function to sort the group according to a particular value and order. For example, to sort game objects for Zelda-style overlaps you might call group.sort(FlxSort.byY, FlxSort.ASCENDING) at the bottom of your FlxState#update() override.

Parameters:

Function

The sorting function to use - you can use one of the premade ones in FlxSort or write your own using FlxSort.byValues() as a "backend".

Order

A constant that defines the sort order. Possible values are FlxSort.ASCENDING (default) and FlxSort.DESCENDING.

@:value({ Y : 0, X : 0 })inlinestamp(Brush:FlxSprite, X:Int = 0, Y:Int = 0):Void

This functionality isn't supported in SpriteGroup

@:generictransformChildren<V>(Function:(T, V) ‑> Void, Value:V):Void

Handy function that allows you to quickly transform one property of sprites in this group at a time.

Parameters:

Function

Function to transform the sprites. Example: function(sprite, v:Dynamic) { s.acceleration.x = v; s.makeGraphic(10,10,0xFF000000); }

Value

Value which will passed to lambda function.

Defined by FlxSprite

@:value({ AdjustPosition : false })centerOffsets(AdjustPosition:Bool = false):Void

Helper function that adjusts the offset automatically to center the bounding box within the graphic.

Parameters:

AdjustPosition

Adjusts the actual X and Y position just once to match the offset change.

inlinecenterOrigin():Void

Sets the sprite's origin to its center - useful after adjusting scale to make sure rotations work as expected.

@:value({ Force : false })drawFrame(Force:Bool = false):Void

Request (or force) that the sprite update the frame before rendering. Useful if you are doing procedural generation or other weirdness!

Parameters:

Force

Force the frame to redraw, even if its not flagged as necessary.

getGraphicMidpoint(?point:FlxPoint):FlxPoint

Retrieve the midpoint of this sprite's graphic in world coordinates.

Parameters:

point

Allows you to pass in an existing FlxPoint if you're so inclined. Otherwise a new one is created.

Returns:

A FlxPoint containing the midpoint of this sprite's graphic in world coordinates.

getPixelAt(worldPoint:FlxPoint, ?camera:FlxCamera):Null<FlxColor>

Determines which of this sprite's pixels are at the specified world coordinate, if any. Factors in scale, angle, offset, origin, and scrollFactor.

Parameters:

worldPoint

The point in world space

camera

The camera, used for scrollFactor. If null, FlxG.camera is used.

Returns:

a FlxColor, if the point is in the sprite's graphic, otherwise null is returned.

Available since

5.0.0

.

getPixelAtScreen(screenPoint:FlxPoint, ?camera:FlxCamera):Null<FlxColor>

Determines which of this sprite's pixels are at the specified screen coordinate, if any. Factors in scale, angle, offset, origin, and scrollFactor.

Parameters:

screenPoint

The point in screen space

camera

The desired "screen" coordinate space. If null, FlxG.camera is used.

Returns:

a FlxColor, if the point is in the sprite's graphic, otherwise null is returned.

Available since

5.0.0

.

getRotatedBounds(?newRect:FlxRect):FlxRect

Calculates the smallest globally aligned bounding box that encompasses this sprite's width and height, at its current rotation. Note, if called on a FlxSprite, the origin is used, but scale and offset are ignored. Use getScreenBounds to use these properties.

Parameters:

newRect

The optional output FlxRect to be returned, if null, a new one is created.

Returns:

A globally aligned FlxRect that fully contains the input object's width and height.

Available since

4.11.0

.

getScreenBounds(?newRect:FlxRect, ?camera:FlxCamera):FlxRect

Calculates the smallest globally aligned bounding box that encompasses this sprite's graphic as it would be displayed. Honors scrollFactor, rotation, scale, offset and origin.

Parameters:

newRect

Optional output FlxRect, if null, a new one is created.

camera

Optional camera used for scrollFactor, if null FlxG.camera is used.

Returns:

A globally aligned FlxRect that fully contains the input sprite.

Available since

4.11.0

.

graphicLoaded():Void

Called whenever a new graphic is loaded for this sprite (after loadGraphic(), makeGraphic() etc).

isSimpleRender(?camera:FlxCamera):Bool

Returns the result of isSimpleRenderBlit() if FlxG.renderBlit is true, or false if FlxG.renderTile is true.

isSimpleRenderBlit(?camera:FlxCamera):Bool

Determines the function used for rendering in blitting: copyPixels() for simple sprites, draw() for complex ones. Sprites are considered simple when they have an angle of 0, a scale of 1, don't use blend and pixelPerfectRender is true.

Parameters:

camera

If a camera is passed its pixelPerfectRender flag is taken into account

@:value({ AutoBuffer : false, AntiAliasing : false, Rotations : 16 })loadRotatedFrame(Frame:FlxFrame, Rotations:Int = 16, AntiAliasing:Bool = false, AutoBuffer:Bool = false):FlxSprite

Helper method which allows using FlxFrame as graphic source for sprite's loadRotatedGraphic() method.

Parameters:

frame

Frame to load into this sprite.

rotations

The number of rotation frames the final sprite should have. For small sprites this can be quite a large number (360 even) without any problems.

antiAliasing

Whether to use high quality rotations when creating the graphic. Default is false.

autoBuffer

Whether to automatically increase the image size to accommodate rotated corners. Will create frames that are 150% larger on each axis than the original frame or graphic.

Returns:

this FlxSprite with loaded rotated graphic in it.

inlineresetFrame():Void

Helper method just for convenience, so you don't need to type sprite.frame = sprite.frame; You may need this method in tile render mode, when you want sprite to use its original graphic, not the graphic generated from its framePixels.

inlineresetFrameSize():Void

Resets frame size to frame dimensions.

inlineresetSize():Void

Resets some internal variables used for frame BitmapData calculation.

inlineresetSizeFromFrame():Void

Resets sprite's size back to frame size.

@:value({ alphaOffset : 0.0, blueOffset : 0.0, greenOffset : 0.0, redOffset : 0.0, alphaMultiplier : 1.0, blueMultiplier : 1.0, greenMultiplier : 1.0, redMultiplier : 1.0 })setColorTransform(redMultiplier:Float = 1.0, greenMultiplier:Float = 1.0, blueMultiplier:Float = 1.0, alphaMultiplier:Float = 1.0, redOffset:Float = 0.0, greenOffset:Float = 0.0, blueOffset:Float = 0.0, alphaOffset:Float = 0.0):Void

Sets the sprite's color transformation with control over color offsets. With FlxG.renderTile, offsets are only supported on OpenFL Next version 3.6.0 or higher.

Parameters:

redMultiplier

The value for the red multiplier, in the range from 0 to 1.

greenMultiplier

The value for the green multiplier, in the range from 0 to 1.

blueMultiplier

The value for the blue multiplier, in the range from 0 to 1.

alphaMultiplier

The value for the alpha transparency multiplier, in the range from 0 to 1.

redOffset

The offset value for the red color channel, in the range from -255 to 255.

greenOffset

The offset value for the green color channel, in the range from -255 to 255.

blueOffset

The offset for the blue color channel value, in the range from -255 to 255.

alphaOffset

The offset for alpha transparency channel value, in the range from -255 to 255.

inlinesetFacingFlip(Direction:FlxDirectionFlags, FlipX:Bool, FlipY:Bool):Void

Set how a sprite flips when facing in a particular direction.

Parameters:

Direction

Use constants LEFT, RIGHT, UP, and DOWN. These may be combined with the bitwise OR operator. E.g. To make a sprite flip horizontally when it is facing both UP and LEFT, use setFacingFlip(LEFT | UP, true, false);

FlipX

Whether to flip the sprite on the X axis.

FlipY

Whether to flip the sprite on the Y axis.

@:value({ saveAnimations : true })@:access(flixel.animation.FlxAnimationController)setFrames(Frames:FlxFramesCollection, saveAnimations:Bool = true):FlxSprite

Sets frames and allows you to save animations in sprite's animation controller

Parameters:

Frames

Frames collection to set for this sprite.

saveAnimations

Whether to save animations in animation controller or not.

Returns:

This sprite with loaded frames

@:value({ height : 0.0, width : 0.0 })setGraphicSize(width:Float = 0.0, height:Float = 0.0):Void

Helper function to set the graphic's dimensions by using scale, allowing you to keep the current aspect ratio should one of the numbers be <= 0. It might make sense to call updateHitbox() afterwards!

Parameters:

width

How wide the graphic should be. If <= 0, and height is set, the aspect ratio will be kept.

height

How high the graphic should be. If <= 0, and width is set, the aspect ratio will be kept.

transformScreenToPixels(screenPoint:FlxPoint, ?camera:FlxCamera, ?result:FlxPoint):FlxPoint

Converts the point from screen coordinates to this sprite's pixel coordinates where (0,0) is the top left of the graphic. Factors in scale, angle, offset, origin, and scrollFactor.

Parameters:

screenPoint

The screen coordinates

camera

The desired "screen" coordinate space. If null, FlxG.camera is used.

result

Optional arg for the returning point

transformWorldToPixels(worldPoint:FlxPoint, ?camera:FlxCamera, ?result:FlxPoint):FlxPoint

Converts the point from world coordinates to this sprite's pixel coordinates where (0,0) is the top left of the graphic. Factors in scale, angle, offset, origin, and scrollFactor.

Parameters:

worldPoint

The world coordinates.

camera

The camera, used for scrollFactor. If null, FlxG.camera is used.

result

Optional arg for the returning point

transformWorldToPixelsSimple(worldPoint:FlxPoint, ?result:FlxPoint):FlxPoint

Converts the point from world coordinates to this sprite's pixel coordinates where (0,0) is the top left of the graphic. Same as worldToPixels but never uses a camera, therefore scrollFactor is ignored

Parameters:

worldPoint

The world coordinates.

result

Optional arg for the returning point

updateFramePixels():BitmapData

Retrieves the BitmapData of the current FlxFrame. Updates framePixels.

updateHitbox():Void

Updates the sprite's hitbox (width, height, offset) according to the current scale. Also calls centerOrigin().

Defined by FlxObject

drawDebugOnCamera(camera:FlxCamera):Void

Override this function to draw custom "debug mode" graphics to the specified camera while the debugger's drawDebug mode is toggled on.

Parameters:

Camera

Which camera to draw the debug visuals to.

getMidpoint(?point:FlxPoint):FlxPoint

Retrieve the midpoint of this object in world coordinates.

Parameters:

point

Allows you to pass in an existing FlxPoint object if you're so inclined. Otherwise a new one is created.

Returns:

A FlxPoint object containing the midpoint of this object in world coordinates.

getPosition(?result:FlxPoint):FlxPoint

Returns the world position of this object.

Parameters:

result

Optional arg for the returning point.

Returns:

The world position of this object.

getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint

Returns the screen position of this object.

Parameters:

result

Optional arg for the returning point

camera

The desired "screen" coordinate space. If null, FlxG.camera is used.

Returns:

The screen position of this object.

hurt(damage:Float):Void

Deprecated: "object.health is being removed in version 6.0.0"

Reduces the health variable of this object by the amount specified in Damage. Calls kill() if health drops to or below zero.

Parameters:

Damage

How much health to take away (use a negative number to give a health bonus).

inlineinWorldBounds():Bool

Check and see if this object is currently within the world bounds - useful for killing objects that get too far away.

Returns:

Whether the object is within the world bounds or not.

isPixelPerfectRender(?camera:FlxCamera):Bool

Check if object is rendered pixel perfect on a specific camera.

inlineisTouching(direction:FlxDirectionFlags):Bool

Handy function for checking if this object is touching a particular surface. Note: These flags are set from FlxG.collide calls, and get reset in super.update().

Parameters:

direction

Any of the collision flags (e.g. LEFT, FLOOR, etc).

Returns:

Whether the object is touching an object in (any of) the specified direction(s) this frame.

inlinejustTouched(direction:FlxDirectionFlags):Bool

Handy function for checking if this object is just landed on a particular surface. Note: These flags are set from FlxG.collide calls, and get reset in super.update().

Parameters:

direction

Any of the collision flags (e.g. LEFT, FLOOR, etc).

Returns:

Whether the object just landed on (any of) the specified surface(s) this frame.

@:value({ inScreenSpace : false })@:access(flixel.group.FlxTypedGroup)overlaps(objectOrGroup:FlxBasic, inScreenSpace:Bool = false, ?camera:FlxCamera):Bool

Checks to see if some FlxObject overlaps this FlxObject or FlxGroup. If the group has a LOT of things in it, it might be faster to use FlxG.overlap(). WARNING: Currently tilemaps do NOT support screen space overlap checks!

Parameters:

objectOrGroup

The object or group being tested.

inScreenSpace

Whether to take scroll factors into account when checking for overlap. Default is false, or "only compare in world space."

camera

Specify which game camera you want. If null, it will just grab the first global camera.

Returns:

Whether or not the two objects overlap.

@:value({ inScreenSpace : false })@:access(flixel.group.FlxTypedGroup)overlapsAt(x:Float, y:Float, objectOrGroup:FlxBasic, inScreenSpace:Bool = false, ?camera:FlxCamera):Bool

Checks to see if this FlxObject were located at the given position, would it overlap the FlxObject or FlxGroup? This is distinct from overlapsPoint(), which just checks that point, rather than taking the object's size into account. WARNING: Currently tilemaps do NOT support screen space overlap checks!

Parameters:

x

The X position you want to check. Pretends this object (the caller, not the parameter) is located here.

y

The Y position you want to check. Pretends this object (the caller, not the parameter) is located here.

objectOrGroup

The object or group being tested.

inScreenSpace

Whether to take scroll factors into account when checking for overlap. Default is false, or "only compare in world space."

camera

Specify which game camera you want. If null, it will just grab the first global camera.

Returns:

Whether or not the two objects overlap.

@:value({ axes : XY })inlinescreenCenter(axes:FlxAxes = XY):FlxObject

Centers this FlxObject on the screen, either by the x axis, y axis, or both.

Parameters:

axes

On what axes to center the object (e.g. X, Y, XY) - default is both.

Returns:

This FlxObject for chaining

setSize(width:Float, height:Float):Void

Shortcut for setting both width and Height.

Parameters:

width

The new hitbox width.

height

The new hitbox height.

toString():String

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

Defined by FlxBasic

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

.