Sprite
Extends: AnimatedImage
Properties
spriteSheet(ifDraw2d) — roBitmap to pick cells fromcellWidth(integer) — Width of each animation cell in the sprite image in pixelscellHeight(integer) — Height of each animation cell in the sprite image in pixelsanimations(roAssociativeArray) — Lookup map of animation name -> SpriteAnimation objectactiveAnimation(SpriteAnimation) — The current animation being played
Constructor
new Sprite(
owner: GameEntity,
spriteSheet: ifDraw2d,
cellWidth: integer,
cellHeight: integer,
args?: roAssociativeArray,
): SpriteParameters
owner(GameEntity)spriteSheet(ifDraw2d)cellWidth(integer)cellHeight(integer)args(roAssociativeArray, optional, default: "{}")
Instance Methods
applyPreTranslation(x: float, y: float): void
Apply a pre-translation to set the pivot point for the sprite cell
Parameters
x(float)y(float)
Returns
void
addAnimation(
name: string,
frameList: dynamic,
frameRate: integer,
playMode?: SpritePlayMode,
): BGE.SpriteAnimation
Parameters
name(string)frameList(dynamic)frameRate(integer)playMode(SpritePlayMode, optional, default: "SpritePlayMode.Loop")
Returns
playAnimation(animationName: string): void
Play an animation from the set of animations in this SpriteSheet
Parameters
animationName(string)
Returns
void
getCellDrawIndex(): integer
protected
Returns
integer