phaser/src/particles/Particles.js

81 lines
1.3 KiB
JavaScript
Raw Normal View History

2013-10-01 12:54:29 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.Particles
*/
/**
* Phaser.Particles constructor
* @class Phaser.Particles
* @classdesc Phaser Particles
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
*/
Phaser.Particles = function (game) {
2013-10-01 12:54:29 +00:00
/**
* @property {Description} emitters - Description.
*/
this.emitters = {};
2013-10-01 12:54:29 +00:00
/**
* @property {number} ID - Description.
* @default
*/
this.ID = 0;
};
Phaser.Particles.prototype = {
2013-10-01 12:54:29 +00:00
/**
* Description.
* @method emitters
*/
emitters: null,
2013-10-01 12:54:29 +00:00
/**
* Description.
* @method add
* @param {Description} emitter - Description.
* @return {Description} Description.
*/
add: function (emitter) {
this.emitters[emitter.name] = emitter;
return emitter;
},
2013-10-01 12:54:29 +00:00
/**
* Description.
* @method remove
* @param {Description} emitter - Description.
*/
remove: function (emitter) {
delete this.emitters[emitter.name];
},
2013-10-01 12:54:29 +00:00
/**
* Description.
* @method update
* @param {Description} emitter - Description.
*/
update: function () {
for (var key in this.emitters)
{
if (this.emitters[key].exists)
{
this.emitters[key].update();
}
}
},
};