You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it took me some time to figure out what I were doing wrong while loading a tmx tilemap. I started out by installing tiled, loading a simple png tileset and by creating a basic tilemap. I saved it and tried to load it just as in the samples. But actually I got strange errors:
cocos2d: Warning: TMX Layer Kachelebene 1 has no tiles
Assertion failed: TextureAtlas.initWithTexture():texture should not be null
Uncaught TypeError: Cannot read property 'width' of undefined
I tried the sample maps and they did load. Finally I debugged the parser and came to the conclusion that zlib is not yet supported, but the cc.Assert before accepts it. As tiled standard compression setting is zlib (at least on my mac) it should be mentioned somewhere and a readable error should be thrown.
Here the excerpt from CCTMXXMLParser.js (note line 1 and the case 'zlib'):
cc.Assert(compression == null || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method");
switch (compression) {
case 'gzip':
layer._tiles = cc.unzipBase64AsArray(nodeValue, 4);
break;
case 'zlib':
//Not Implemented
break;
// Uncompressed
case null:
case '':
if (encoding == "base64") {
layer._tiles = cc.Codec.Base64.decodeAsArray(nodeValue, 4);
}
else {
layer._tiles = cc.StringToArray(nodeValue);
}
break;
default:
cc.Assert(this.getLayerAttribs() != cc.TMXLayerAttribNone, "TMX tile map: Only base64 and/or gzip/zlib maps are supported");
}
The text was updated successfully, but these errors were encountered:
Hi,
it took me some time to figure out what I were doing wrong while loading a tmx tilemap. I started out by installing tiled, loading a simple png tileset and by creating a basic tilemap. I saved it and tried to load it just as in the samples. But actually I got strange errors:
cocos2d: Warning: TMX Layer Kachelebene 1 has no tiles
Assertion failed: TextureAtlas.initWithTexture():texture should not be null
Uncaught TypeError: Cannot read property 'width' of undefined
I tried the sample maps and they did load. Finally I debugged the parser and came to the conclusion that zlib is not yet supported, but the cc.Assert before accepts it. As tiled standard compression setting is zlib (at least on my mac) it should be mentioned somewhere and a readable error should be thrown.
Here the excerpt from CCTMXXMLParser.js (note line 1 and the case 'zlib'):
cc.Assert(compression == null || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method");
switch (compression) {
case 'gzip':
layer._tiles = cc.unzipBase64AsArray(nodeValue, 4);
break;
case 'zlib':
//Not Implemented
break;
// Uncompressed
case null:
case '':
if (encoding == "base64") {
layer._tiles = cc.Codec.Base64.decodeAsArray(nodeValue, 4);
}
else {
layer._tiles = cc.StringToArray(nodeValue);
}
break;
default:
cc.Assert(this.getLayerAttribs() != cc.TMXLayerAttribNone, "TMX tile map: Only base64 and/or gzip/zlib maps are supported");
}
The text was updated successfully, but these errors were encountered: