BGE/ProceduralFrames
Animation frames drawn in code instead of loaded from art.
Alias: BGE.ProceduralFrames
Static Methods
flame(
game: BGE.Game,
bitmapName: string,
options: BGE.FlameFrameOptions,
): Array.<roRegion>
A looping flame: squares that rise, shrink, fade and cool from startColor to endColor, staggered so the loop is seamless. The strip is drawn once and kept in the game under bitmapName; later calls with that name reuse it and ignore the colours, so use one name per look (and the same frame sizes). Play the frames with GameEntity.addAnimatedImage(), unshaded, anchored at the bottom; one loop of 560 ms suits the defaults.
Parameters
game(BGE.Game) — keeps the strip bitmapbitmapName(string)options(BGE.FlameFrameOptions)
Returns
Array.<roRegion>— one region per frame, in order
Example
frames = BGE.ProceduralFrames.flame(m.game, "torchFlame", {startColor: &hFFE89A, endColor: &hC02808})
image = m.addAnimatedImage("flame", frames, {drawMode: BGE.SceneObjectDrawMode.axisAligned, animationDurationMs: 560})
image.setAnchor(0.5, 1)drawFlameStrip(options: BGE.FlameFrameOptions): roBitmap
Draws flame()'s strip without caching it: every frame side by side, left to right.
Parameters
options(BGE.FlameFrameOptions)
Returns
roBitmap— frameCount * frameWidth wide
flameDefaults(
options: BGE.FlameFrameOptions,
): BGE.FlameFrameOptions
A copy of options with every unset field at its default.
Parameters
options(BGE.FlameFrameOptions)
Returns
loopAge(
frame: integer,
frameCount: integer,
index: integer,
count: integer,
): float
How far through its life (0-1) item index of count is in frame of frameCount: each lives one loop, the items a fraction of a life apart, so the loop is seamless.
Parameters
frame(integer)frameCount(integer)index(integer)count(integer)
Returns
float