Class: BHell_Emitter_Factory

BHell.BHell_Emitter_Factory()

new BHell_Emitter_Factory()

Pseudo FactoryMethod pattern for the emitters usable by the player.

Source:

Methods

(static) create(emitter, x, y, w, h, params, parent, bulletList) → {*}

Parses emitter.type and creates a new emitter accordingly.

Implemented types are: "base", "spray", "rotate" and "burst".

Parameters:
Name Type Description
emitter

JSON description of the emitter

x

X coordinate for the parser.

y

Y spawning coordinate for the parser.

w

Width for the parser.

h

Height for the parser.

params

Parameters for the emitter.

parent

Sprites container.

bulletList

Array in which the bullets will be pushed.

Source:
Returns:

An instance of the requested emitter if emitter.type could be parsed, null otherwise.

Type
*

(static) parseEmitter(emitter, x, y, w, h, rate, power, parent, bulletList) → {*}

Returns a new emitter suitable for the player (i.e. not aiming at it) with given parameters. The emitters' JSON description has the following fields:

  • type: string identifying the emitter class (@see BHell.BHell_Emitter_Factory#create),
  • params: parameters for the emitter (see BHell.BHell_Emitter_Base and derived classes for its content).
Parameters:
Name Type Description
emitter

JSON description for the emitter.

x

X coordinate for the parser.

y

Y spawning coordinate for the parser.

w

Width for the parser.

h

Height for the parser.

rate

Rate of fire rank for the emitter (D = 1, C = 2, B = 3, A = 4, S = 5), it multiplies the emitter's period.

power

Fire power rank for the emitter (D, C, B, A, S), enables some emitters instead of others.

parent

Sprites container.

bulletList

Array in which the bullets will be pushed.

Source:
Returns:

An instance of the requested emitter if emitter.params.ranks contains power, null otherwise.

Type
*