Class: ExplosionFactory

ExplosionFactory(game)

Particle Explosion factory - controls creation and destruction of particle explosions.

Constructor

new ExplosionFactory(game)

Create a new explosion factory
Parameters:
Name Type Description
game SpaceInvaders The current game instance
Author:
Source:

Extends

Methods

canMake() → {boolean}

Check if we can make a new instance based on maxItems
Inherited From:
Source:
Returns:
Type
boolean

destroy(item) → {Object}

Destroy an instance created by this factory
Parameters:
Name Type Description
item Object The item / instance to destroy
Inherited From:
Source:
Returns:
Returns the instance created
Type
Object

make(startX, startY, colour, particlesMax, gravity)

Call this to create a new explosion on screen
Parameters:
Name Type Description
startX number The center point
startY number The center point
colour string Colour of the particles
particlesMax number Maximum number of particles
gravity boolean Simulate gravity on the explosion particles
Overrides:
Source:

makeItem(startX, startY, colour, particlesMax, particleSize, gravity)

Return a new Explosion instance, called by the make() method.
Parameters:
Name Type Description
startX number The center point
startY number The center point
colour string Colour of the particles
particlesMax number Maximum number of particles
particleSize number Size of particles in new explosion
gravity boolean Simulate gravity on the explosion particles
Overrides:
Source:

reset()

Destroy all items and reset the data
Inherited From:
Source:

resetCountdown()

Restart the auto make countdown based on max / min delay
Inherited From:
Source:

update()

Main update loop called by game loop. Calls update on all active Explosion instances
Overrides:
Source: