API Docs for: v0.1.0
Show:

SpritePool Class

Extends Object

Holds a pool of different Sprites that can be created, makes it very easy to quickly create different registered entities

Constructor

SpritePool

(
  • game
)

Parameters:

  • game Game

    The game instance this sprite pool belongs to

Item Index

Methods

Properties

Methods

add

(
  • name
  • obj
)
Sprite

Adds an Sprite Type to the pool

Parameters:

  • name String

    The user-defined name of the Sprite Type to add

  • obj Sprite

    The Sprite or decendant type to add to the pool

Returns:

Sprite:

Returns the passed sprite

create

(
  • name
  • texture
  • props
)
Sprite

Creates a new sprite from the pool

Parameters:

  • name String

    The user-defined name of the Sprite to check if is in the pool

  • texture Texture

    The texture for the sprite

  • props Object

    Extra object that will be passed along (for custom sprite options)

Returns:

Sprite:

Returns a new instance of the object from the pool

free

()

Frees an object back into the pool to be recycled, currently doesn't do any recycling unfortunately

has

(
  • name
)
Boolean

Checks if the Sprite Type exists in the pool

Parameters:

  • name String

    The user-defined name of the Sprite Type to check if is in the pool

Returns:

Boolean:

Properties

game

Game

The game instance this pool belongs to