Loading tilemap with preloaded json object not working
matthias-herbst opened this issue · 1 comments
matthias-herbst commented
Passing a preloaded json object to the game.load.tilemap()-function breaks map.
URL parameter is required.
Phaser tilemap accepts json object instead of a url.
Is there any workaround?
matthias-herbst commented
Found a solution on my own.
I think this would be a great addition to your plugin.
Extend functionality of the Loader.tilemap function (L. 526ff:)
Phaser.Loader.prototype.tilemap = function (t, e, i, a) {
r.call(this, t, e, i, a);
// if url == null && json data passed to load tilemap function
if(e == null && i != null) {
var cacheKey = n(t);
this.game.cache.addJSON(cacheKey, null, this.game.cache.getTilemapData(t).data);
}
else { this.json(n(t), e); }
};