2017-08-15 22:38:35 +00:00
|
|
|
var Class = require('../../utils/Class');
|
2017-08-15 23:30:12 +00:00
|
|
|
var ImpactBody = require('./ImpactBody');
|
2017-08-15 22:38:35 +00:00
|
|
|
var ImpactImage = require('./ImpactImage');
|
|
|
|
var ImpactSprite = require('./ImpactSprite');
|
|
|
|
|
|
|
|
var Factory = new Class({
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
|
|
|
function Factory (world)
|
|
|
|
{
|
|
|
|
this.world = world;
|
|
|
|
|
|
|
|
this.sys = world.scene.sys;
|
|
|
|
},
|
|
|
|
|
2017-08-15 23:30:12 +00:00
|
|
|
body: function (x, y, width, height)
|
2017-08-15 22:38:35 +00:00
|
|
|
{
|
2017-08-15 23:30:12 +00:00
|
|
|
return new ImpactBody(this.world, x, y, width, height);
|
2017-08-15 22:38:35 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
image: function (x, y, key, frame)
|
|
|
|
{
|
|
|
|
var image = new ImpactImage(this.world, x, y, key, frame);
|
|
|
|
|
|
|
|
this.sys.displayList.add(image);
|
|
|
|
|
|
|
|
return image;
|
|
|
|
},
|
|
|
|
|
|
|
|
sprite: function (x, y, key, frame)
|
|
|
|
{
|
|
|
|
var sprite = new ImpactSprite(this.world, x, y, key, frame);
|
|
|
|
|
|
|
|
this.sys.displayList.add(sprite);
|
|
|
|
this.sys.updateList.add(sprite);
|
|
|
|
|
|
|
|
return sprite;
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = Factory;
|