2017-05-19 19:07:30 +00:00
|
|
|
var BuildGameObject = require('../BuildGameObject');
|
2017-09-14 01:27:29 +00:00
|
|
|
var GameObjectCreator = require('../../scene/plugins/GameObjectCreator');
|
|
|
|
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
|
|
|
var Quad = require('./Quad');
|
|
|
|
|
|
|
|
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
2017-05-19 19:07:30 +00:00
|
|
|
|
2017-09-14 01:27:29 +00:00
|
|
|
GameObjectCreator.register('quad', function (config)
|
2017-05-19 19:07:30 +00:00
|
|
|
{
|
2017-05-23 12:29:40 +00:00
|
|
|
var x = GetAdvancedValue(config, 'x', 0);
|
|
|
|
var y = GetAdvancedValue(config, 'y', 0);
|
2017-05-19 19:07:30 +00:00
|
|
|
var key = GetAdvancedValue(config, 'key', null);
|
|
|
|
var frame = GetAdvancedValue(config, 'frame', null);
|
|
|
|
|
2017-09-14 01:27:29 +00:00
|
|
|
var quad = new Quad(this.scene, x, y, key, frame);
|
2017-05-19 19:07:30 +00:00
|
|
|
|
2017-09-14 01:27:29 +00:00
|
|
|
BuildGameObject(this.scene, quad, config);
|
2017-05-19 19:07:30 +00:00
|
|
|
|
|
|
|
return quad;
|
2017-09-14 01:27:29 +00:00
|
|
|
});
|