phaser/v3/src/gameobjects/quad/QuadCreator.js

21 lines
701 B
JavaScript
Raw Normal View History

2017-05-19 19:07:30 +00:00
var BuildGameObject = require('../BuildGameObject');
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
GameObjectCreator.register('quad', function (config)
2017-05-19 19:07:30 +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);
var quad = new Quad(this.scene, x, y, key, frame);
2017-05-19 19:07:30 +00:00
BuildGameObject(this.scene, quad, config);
2017-05-19 19:07:30 +00:00
return quad;
});