API Docs for: v0.1.0
Show:

ObjectPool Class

Extends Object

Holds a pool of different Objects to help reduce the number times an object is created and destroyed.

Constructor

ObjectPool

(
  • type
  • parent
)

Parameters:

  • type Mixed

    The object type that this pool will hold (like Sprite, or Tile)

  • parent Mixed

    The parent that the objects will be added to. Passing this in will make the pool add any newly created objects as children to this object.

Item Index

Methods

Methods

create

() Mixed

Creates a new instance of the pool's object type, or if available pulls one that is already created out of the pool

Returns:

Mixed:

The instance of the object pulled from the pool

free

()

Frees an object back into the pool to be recycled