cykod / Quintus

HTML5 Game Engine
http://html5quintus.com
GNU General Public License v2.0
1.41k stars 401 forks source link

Tmx : empty layer #168

Open Sparksx opened 9 years ago

Sparksx commented 9 years ago

When an layer is empty there is the following error :

Uncaught TypeError: Cannot read property 'tileW' of undefined
Q._tmxProcessTileLayer @ quintus_tmx.js:221
(anonymous function) @ quintus_tmx.js:295
window.(anonymous function).Q._each @ quintus.js:319
Q.stageTMX @ quintus_tmx.js:292
(anonymous function) @ platformer.js:57
Q.Stage.Q.GameObject.extend.loadScene @ quintus_scenes.js:313
Q.stageScene @ quintus_scenes.js:1082
(anonymous function) @ platformer.js:96
window.(anonymous function).Q.load.loadedCallback @ quintus.js:1991
window.(anonymous function).Q.loadAssetImage.img.onload @ quintus.js:1711

It's because the sheetName var is initialised but not assigned. You should ignore an empty layer ?

You can add an if (sheetName) stattement before var tileLayerProperties = Q._extend({ in quintus_tmx.js at line 196. With this, it's work.