phaser/v3/src/gameobjects/image/BuildFromConfig.js

18 lines
470 B
JavaScript
Raw Normal View History

var Image = require('./Image');
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
var BuildGameObject = require('../BuildGameObject');
var BuildFromConfig = function (state, config)
{
var key = GetAdvancedValue(config, 'key', null);
var frame = GetAdvancedValue(config, 'frame', null);
var image = new Image(state, 0, 0, key, frame);
BuildGameObject(state, image, config);
return image;
};
module.exports = BuildFromConfig;