cykod / Quintus

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

multilayer support for TMX files #49

Closed fariazz closed 11 years ago

fariazz commented 11 years ago

Added the ability for the user to specify which layer in the TMX file will be used.

Tested in a platformer where I used one layer for the collision and one for background, it works fine:

Q.scene("level1",function(stage) {

            //background
            stage.insert(new Q.TileLayer({ dataAsset: 'level1.tmx', layerIndex: 0, sheet: 'tiles', tileW: 70, tileH: 70, type: Q.SPRITE_NONE }));

            stage.collisionLayer(new Q.TileLayer({ dataAsset: 'level1.tmx', layerIndex:1,  sheet: 'tiles', tileW: 70, tileH: 70 }));

            var player = stage.insert(new Q.Player());
            stage.add("viewport").follow(player);          
        });