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>

static

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

Returns

  • Array.<roRegion> — one region per frame, in order

Example

CODE
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

static

Draws flame()'s strip without caching it: every frame side by side, left to right.

Parameters

Returns

  • roBitmap — frameCount * frameWidth wide

flameDefaults( options: BGE.FlameFrameOptions, ): BGE.FlameFrameOptions

static

A copy of options with every unset field at its default.

Parameters

Returns

loopAge( frame: integer, frameCount: integer, index: integer, count: integer, ): float

static

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