dist/melonjs.js
function parseTMXShapes() {
         var i = 0;
         var shapes = []; // add an ellipse shape

         if (this.isEllipse === true) {
           // ellipse coordinates are the center position, so set default to the corresonding radius
           shapes.push(new me.Ellipse(this.width / 2, this.height / 2, this.width, this.height).rotate(this.rotation));
         } // add a polygon
         else if (this.isPolygon === true) {
             shapes.push(new me.Polygon(0, 0, this.points).rotate(this.rotation));
           } // add a polyline
           else if (this.isPolyLine === true) {
               var p = this.points;
               var p1, p2;
               var segments = p.length - 1;

               for (i = 0; i < segments; i++) {
                 // clone the value before, as [i + 1]
                 // is reused later by the next segment
                 p1 = new me.Vector2d(p[i].x, p[i].y);
                 p2 = new me.Vector2d(p[i + 1].x, p[i + 1].y);

                 if (this.rotation !== 0) {
                   p1 = p1.rotate(this.rotation);
                   p2 = p2.rotate(this.rotation);
                 }

                 shapes.push(new me.Line(0, 0, [p1, p2]));
               }
             } // it's a rectangle, returns a polygon object anyway
             else {
                 shapes.push(new me.Polygon(0, 0, [new me.Vector2d(), new me.Vector2d(this.width, 0), new me.Vector2d(this.width, this.height), new me.Vector2d(0, this.height)]).rotate(this.rotation));
               } // Apply isometric projection


         if (this.orientation === "isometric") {
           for (i = 0; i < shapes.length; i++) {
             shapes[i].toIso();
           }
         }

         return shapes;
       }
function parseTMXShapes() {
         var i = 0;
         var shapes = []; // add an ellipse shape

         if (this.isEllipse === true) {
           // ellipse coordinates are the center position, so set default to the corresonding radius
           shapes.push(new me.Ellipse(this.width / 2, this.height / 2, this.width, this.height).rotate(this.rotation));
         } // add a polygon
         else if (this.isPolygon === true) {
             shapes.push(new me.Polygon(0, 0, this.points).rotate(this.rotation));
           } // add a polyline
           else if (this.isPolyLine === true) {
               var p = this.points;
               var p1, p2;
               var segments = p.length - 1;

               for (i = 0; i < segments; i++) {
                 // clone the value before, as [i + 1]
                 // is reused later by the next segment
                 p1 = new me.Vector2d(p[i].x, p[i].y);
                 p2 = new me.Vector2d(p[i + 1].x, p[i + 1].y);

                 if (this.rotation !== 0) {
                   p1 = p1.rotate(this.rotation);
                   p2 = p2.rotate(this.rotation);
                 }

                 shapes.push(new me.Line(0, 0, [p1, p2]));
               }
             } // it's a rectangle, returns a polygon object anyway
             else {
                 shapes.push(new me.Polygon(0, 0, [new me.Vector2d(), new me.Vector2d(this.width, 0), new me.Vector2d(this.width, this.height), new me.Vector2d(0, this.height)]).rotate(this.rotation));
               } // Apply isometric projection


         if (this.orientation === "isometric") {
           for (i = 0; i < shapes.length; i++) {
             shapes[i].toIso();
           }
         }

         return shapes;
       }
function parseTMXShapes ( ) { var i = 0 ; var shapes = [ ] ; // add an ellipse shape if ( this . isEllipse === true ) { // ellipse coordinates are the center position, so set default to the corresonding radius shapes . push ( new me . Ellipse ( this . width / 2 , this . height / 2 , this . width , this . height ) . rotate ( this . rotation ) ) ; } // add a polygon else if ( this . isPolygon === true ) { shapes . push ( new me . Polygon ( 0 , 0 , this . points ) . rotate ( this . rotation ) ) ; } // add a polyline else if ( this . isPolyLine === true ) { var p = this . points ; var p1 , p2 ; var segments = p . length - 1 ; for ( i = 0 ; i < segments ; i ++ ) { // clone the value before, as [i + 1] // is reused later by the next segment p1 = new me . Vector2d ( p [ i ] . x , p [ i ] . y ) ; p2 = new me . Vector2d ( p [ i + 1 ] . x , p [ i + 1 ] . y ) ; if ( this . rotation !== 0 ) { p1 = p1 . rotate ( this . rotation ) ; p2 = p2 . rotate ( this . rotation ) ; } shapes . push ( new me . Line ( 0 , 0 , [ p1 , p2 ] ) ) ; } } // it's a rectangle, returns a polygon object anyway else { shapes . push ( new me . Polygon ( 0 , 0 , [ new me . Vector2d ( ) , new me . Vector2d ( this . width , 0 ) , new me . Vector2d ( this . width , this . height ) , new me . Vector2d ( 0 , this . height ) ] ) . rotate ( this . rotation ) ) ; } // Apply isometric projection if ( this . orientation === "isometric" ) { for ( i = 0 ; i < shapes . length ; i ++ ) { shapes [ i ] . toIso ( ) ; } } return shapes ; }
parses the TMX shape definition and returns a corresponding array of me.Shape object
@name parseTMXShapes
@memberOf me.TMXObject
@private
@function
@return {me.Polygon[]|me.Line[]|me.Ellipse[]} an array of shape objects
parses the TMX shape definition and returns a corresponding array of me . Shape object