mirror of
https://github.com/photonstorm/phaser
synced 2025-01-10 20:28:56 +00:00
27 lines
907 B
JavaScript
27 lines
907 B
JavaScript
|
var StaticTilemap = require('./StaticTilemap');
|
||
|
var GetValue = require('../../../utils/object/GetValue');
|
||
|
var BuildGameObject = require('../../BuildGameObject');
|
||
|
|
||
|
var BuildFromConfig = function (state, config)
|
||
|
{
|
||
|
var mapData = GetValue(config, 'map.data', null);
|
||
|
var mapWidth = GetValue(config, 'map.width', 1);
|
||
|
var mapHeight = GetValue(config, 'map.height', 1);
|
||
|
|
||
|
var x = GetValue(config, 'x', 0);
|
||
|
var y = GetValue(config, 'y', 0);
|
||
|
|
||
|
var tileWidth = GetValue(config, 'tile.width', 16);
|
||
|
var tileHeight = GetValue(config, 'tile.height', 16);
|
||
|
var tileTexture = GetValue(config, 'tile.texture', null);
|
||
|
var tileFrame = GetValue(config, 'tile.frame', null);
|
||
|
|
||
|
var map = new StaticTilemap(state, mapData, x, y, tileWidth, tileHeight, mapWidth, mapHeight, tileTexture, tileFrame);
|
||
|
|
||
|
BuildGameObject(state, map, config);
|
||
|
|
||
|
return map;
|
||
|
};
|
||
|
|
||
|
module.exports = BuildFromConfig;
|