Reference Source Test
public class | source

Sprites

Class responsible for loading all the necessary sprites from the JSON.

Constructor Summary

Public Constructor
public

constructor(renderer: Renderer)

Default constructor

Member Summary

Public Members
public

A callback function when all sprites are loaded

public

An instance of the game renderer

public

An animation for sparks

public

An array of sprites

Method Summary

Public Methods
public

Load animations

public

loadSpriteData(spriteData: Array)

Load data for a sprite

public

Once a sprite is loaded set the sprites callback

public

Update sprites in the render loop

Public Constructors

public constructor(renderer: Renderer) source

Default constructor

Params:

NameTypeAttributeDescription
renderer Renderer

instance of the renderer

Public Members

public loadedSpritesCallback: Function source

A callback function when all sprites are loaded

public renderer: Renderer source

An instance of the game renderer

public sparksAnimation: Animation source

An animation for sparks

public sprites: Sprite[] source

An array of sprites

Public Methods

public loadAnimations() source

Load animations

public loadSpriteData(spriteData: Array) source

Load data for a sprite

Params:

NameTypeAttributeDescription
spriteData Array

an array of data for the sprites to load

public onLoadedSprites(callback: Function) source

Once a sprite is loaded set the sprites callback

Params:

NameTypeAttributeDescription
callback Function

the callback for the sprite

public updateSprites() source

Update sprites in the render loop