mirror of
https://github.com/photonstorm/phaser
synced 2025-01-27 12:25:09 +00:00
19 lines
656 B
JavaScript
19 lines
656 B
JavaScript
|
var BuildGameObject = require('../BuildGameObject');
|
||
|
var GameObjectCreator = require('../../scene/plugins/GameObjectCreator');
|
||
|
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
||
|
var ParticleEmitter = require('./ParticleEmitter');
|
||
|
|
||
|
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
||
|
|
||
|
GameObjectCreator.register('particles', function (config)
|
||
|
{
|
||
|
var key = GetAdvancedValue(config, 'key', null);
|
||
|
var frame = GetAdvancedValue(config, 'frame', null);
|
||
|
|
||
|
var emitter = new ParticleEmitter(this.scene, 0, 0, key, frame);
|
||
|
|
||
|
BuildGameObject(this.scene, emitter, config);
|
||
|
|
||
|
return emitter;
|
||
|
});
|