src/level/tiled/TMXTiledMap.js
function (data) {

            if (this.initialized === true) {
                return;
            }

            // to automatically increment z index
            var zOrder = 0;
            var self = this;

            // Tileset information
            if (!this.tilesets) {
                // make sure we have a TilesetGroup Object
                this.tilesets = new me.TMXTilesetGroup();
            }

            // parse all tileset objects
            if (typeof (data.tilesets) !== "undefined") {
                var tilesets = data.tilesets;
                tilesets.forEach(function (tileset) {
                    // add the new tileset
                    self.tilesets.add(readTileset(tileset));
                });
            }

            // check if a user-defined background color is defined
            if (this.backgroundcolor) {
                this.layers.push(
                    me.pool.pull("me.ColorLayer",
                        "background_color",
                        this.backgroundcolor,
                        zOrder++
                    )
                );
            }

            // check if a background image is defined
            if (this.background_image) {
                // add a new image layer
                this.layers.push(
                    me.pool.pull("me.ImageLayer",
                        0, 0, {
                            name : "background_image",
                            image : this.background_image,
                            z : zOrder++
                        }
                ));
            }

            data.layers.forEach(function (layer) {
                switch (layer.type) {
                    case "imagelayer":
                        self.layers.push(readImageLayer(self, layer, zOrder++));
                        break;

                    case "tilelayer":
                        self.layers.push(readLayer(self, layer, zOrder++));
                        break;

                    // get the object groups information
                    case "objectgroup":
                        self.objectGroups.push(readObjectGroup(self, layer, zOrder++));
                        break;

                    // get the object groups information
                    case "group":
                        self.objectGroups.push(readObjectGroup(self, layer, zOrder++));
                        break;

                    default:
                        break;
                }
            });

            this.initialized = true;
        }
function (data) {

            if (this.initialized === true) {
                return;
            }

            // to automatically increment z index
            var zOrder = 0;
            var self = this;

            // Tileset information
            if (!this.tilesets) {
                // make sure we have a TilesetGroup Object
                this.tilesets = new me.TMXTilesetGroup();
            }

            // parse all tileset objects
            if (typeof (data.tilesets) !== "undefined") {
                var tilesets = data.tilesets;
                tilesets.forEach(function (tileset) {
                    // add the new tileset
                    self.tilesets.add(readTileset(tileset));
                });
            }

            // check if a user-defined background color is defined
            if (this.backgroundcolor) {
                this.layers.push(
                    me.pool.pull("me.ColorLayer",
                        "background_color",
                        this.backgroundcolor,
                        zOrder++
                    )
                );
            }

            // check if a background image is defined
            if (this.background_image) {
                // add a new image layer
                this.layers.push(
                    me.pool.pull("me.ImageLayer",
                        0, 0, {
                            name : "background_image",
                            image : this.background_image,
                            z : zOrder++
                        }
                ));
            }

            data.layers.forEach(function (layer) {
                switch (layer.type) {
                    case "imagelayer":
                        self.layers.push(readImageLayer(self, layer, zOrder++));
                        break;

                    case "tilelayer":
                        self.layers.push(readLayer(self, layer, zOrder++));
                        break;

                    // get the object groups information
                    case "objectgroup":
                        self.objectGroups.push(readObjectGroup(self, layer, zOrder++));
                        break;

                    // get the object groups information
                    case "group":
                        self.objectGroups.push(readObjectGroup(self, layer, zOrder++));
                        break;

                    default:
                        break;
                }
            });

            this.initialized = true;
        }
function ( data ) { if ( this . initialized === true ) { return ; } // to automatically increment z index var zOrder = 0 ; var self = this ; // Tileset information if ( ! this . tilesets ) { // make sure we have a TilesetGroup Object this . tilesets = new me . TMXTilesetGroup ( ) ; } // parse all tileset objects if ( typeof ( data . tilesets ) !== "undefined" ) { var tilesets = data . tilesets ; tilesets . forEach ( function ( tileset ) { // add the new tileset self . tilesets . add ( readTileset ( tileset ) ) ; } ) ; } // check if a user-defined background color is defined if ( this . backgroundcolor ) { this . layers . push ( me . pool . pull ( "me.ColorLayer" , "background_color" , this . backgroundcolor , zOrder ++ ) ) ; } // check if a background image is defined if ( this . background_image ) { // add a new image layer this . layers . push ( me . pool . pull ( "me.ImageLayer" , 0 , 0 , { name : "background_image" , image : this . background_image , z : zOrder ++ } ) ) ; } data . layers . forEach ( function ( layer ) { switch ( layer . type ) { case "imagelayer" : self . layers . push ( readImageLayer ( self , layer , zOrder ++ ) ) ; break ; case "tilelayer" : self . layers . push ( readLayer ( self , layer , zOrder ++ ) ) ; break ; // get the object groups information case "objectgroup" : self . objectGroups . push ( readObjectGroup ( self , layer , zOrder ++ ) ) ; break ; // get the object groups information case "group" : self . objectGroups . push ( readObjectGroup ( self , layer , zOrder ++ ) ) ; break ; default : break ; } } ) ; this . initialized = true ; }
parse the map
@ignore
parse the map