Skip to content
ClassAnimation & Atlases@public

FlxAtlas

A loaded texture atlas with named frame lookup and ordered pickers.

Obtain instances via FlxG.atlas.load(...) / FlxG.atlas.get(...).

ts
export declare class FlxAtlas

Properties

PropertyModifiersTypeDescription
frameCountreadonlynumberNumber of named frames in this atlas.
keyreadonlystring-
texturereadonlyTextureShared base texture (the full atlas sheet).

Methods

framesByNumber()

ts
framesByNumber(start: number, end: number): FlxAtlasFrameList

Return frames by 0-based index range (inclusive) or explicit index array.

Parameters:

ParameterTypeDescription
startnumber-
endnumber-

Returns: FlxAtlasFrameList

framesByNumber()

ts
framesByNumber(indices: readonly number[]): FlxAtlasFrameList

Parameters:

ParameterTypeDescription
indicesreadonly number[]-

Returns: FlxAtlasFrameList

framesByPrefix()

ts
framesByPrefix(prefix: string, start: number, end: number, options?: FlxAtlasPrefixOptions): FlxAtlasFrameList

Return an ordered list of frames whose names match prefix + paddedNumber for each integer in [start, end] inclusive.

options.padding defaults to 1 (no leading zeros) and must be at least 1. Also retries each lookup with a .png suffix (Kenney convention).

Parameters:

ParameterTypeDescription
prefixstring-
startnumber-
endnumber-
optionsFlxAtlasPrefixOptions-

Returns: FlxAtlasFrameList

getFrame()

ts
getFrame(name: string): FlxAtlasFrame

Return the frame with the given exact name, or retry with .png appended (Kenney convention). Throws if neither resolves.

Parameters:

ParameterTypeDescription
namestring-

Returns: FlxAtlasFrame

makeGraphic()

ts
makeGraphic(frames: readonly (FlxAtlasFrame | null)[], frameWidth?: number, frameHeight?: number): Texture

Build a Flixel Texture strip for loadGraphic / tilemaps. Pass null for a fully transparent cell (e.g. tilemap air = index 0). Optional frameWidth / frameHeight scale cells while copying.

Parameters:

ParameterTypeDescription
framesreadonly (FlxAtlasFrame | null)[]-
frameWidthnumber-
frameHeightnumber-

Returns: Texture

Released under the MIT License.