2017-11-11 16:38:52 +00:00
|
|
|
var GameObjectCreator = require('../../scene/plugins/GameObjectCreator');
|
2017-11-17 21:55:12 +00:00
|
|
|
var ParseToTilemap = require('./ParseToTilemap');
|
2017-11-11 16:38:52 +00:00
|
|
|
|
|
|
|
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
|
|
|
|
|
|
|
GameObjectCreator.register('tilemap', function (config)
|
|
|
|
{
|
|
|
|
// config {
|
2017-11-17 21:55:12 +00:00
|
|
|
// key: undefined, (string|number),
|
2017-11-11 16:38:52 +00:00
|
|
|
// tileWidth: 32,
|
|
|
|
// tileHeight: 32,
|
|
|
|
// width: 10,
|
|
|
|
// height: 10,
|
2017-11-14 21:33:13 +00:00
|
|
|
// data: null (2D array of tile indices),
|
|
|
|
// insertNull: false
|
2017-11-11 16:38:52 +00:00
|
|
|
// }
|
|
|
|
|
2017-11-17 21:55:12 +00:00
|
|
|
var c = config !== undefined ? config : {};
|
|
|
|
return ParseToTilemap(this.scene, c.key, c.tileWidth, c.tileHeight, c.width, c.height, c.data, c.insertNull);
|
2017-11-11 16:38:52 +00:00
|
|
|
});
|