2017-11-11 16:38:52 +00:00
|
|
|
var GameObjectFactory = require('../../scene/plugins/GameObjectFactory');
|
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 GameObjectFactory context.
|
|
|
|
//
|
|
|
|
// There are several properties available to use:
|
|
|
|
//
|
|
|
|
// this.scene - a reference to the Scene that owns the GameObjectFactory
|
|
|
|
// this.displayList - a reference to the Display List the Scene owns
|
|
|
|
// this.updateList - a reference to the Update List the Scene owns
|
|
|
|
|
2017-11-17 21:55:12 +00:00
|
|
|
GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, width, height, data, insertNull)
|
2017-11-11 16:38:52 +00:00
|
|
|
{
|
2017-11-17 21:55:12 +00:00
|
|
|
// Allow users to specify null as default parameter, but convert it to undefined to match what
|
|
|
|
// the creator function passed to the parser.
|
|
|
|
if (key === null) { key = undefined; }
|
|
|
|
if (tileWidth === null) { tileWidth = undefined; }
|
|
|
|
if (tileHeight === null) { tileHeight = undefined; }
|
|
|
|
if (width === null) { width = undefined; }
|
|
|
|
if (height === null) { height = undefined; }
|
|
|
|
if (data === null) { data = undefined; }
|
|
|
|
if (insertNull === null) { insertNull = undefined; }
|
2017-11-11 16:38:52 +00:00
|
|
|
|
2017-11-17 21:55:12 +00:00
|
|
|
return ParseToTilemap(this.scene, key, tileWidth, tileHeight, width, height, data, insertNull);
|
2017-11-11 16:38:52 +00:00
|
|
|
});
|