Commits

Anonymous committed c89feba

draw sprites for ground lines

Comments (0)

Files changed (1)

         return shape;
     }
 
+
     var ballColors = {
         "red": {r:255,g:0,b:0},
         "green": {r:0,g:255,b:0}
         warpHoles[ warpHole.body.userData.attributes.warpHoleId ] = warpHole;
     }
 
+    var createGroundSprite = function(x1,y1,x2,y2) {
+        console.log("sprite");
+        var g = new createjs.Graphics();
+        g.setStrokeStyle(2);
+        g.beginStroke(createjs.Graphics.getRGB(100,100,100));
+        g.moveTo(x1*display2d.PTM,-y1*display2d.PTM);
+        g.lineTo(x2*display2d.PTM,-y2*display2d.PTM);
+        g.lineTo(x2*display2d.PTM,-y2*display2d.PTM+6);
+        g.lineTo(x1*display2d.PTM,-y1*display2d.PTM+6);
+        g.lineTo(x1*display2d.PTM,-y1*display2d.PTM);
+        var shape = new createjs.Shape(g);
+        shape.regX = 0;
+        shape.regY = 0;
+        return shape;
+    }
+
     var createGround = function(centerx, centery, x1, y1, x2, y2) {
         bodies.createGround(world, centerx, centery, x1, y1, x2, y2);
+        var sprite = createGroundSprite(x1,y1,x2,y2);
+        var viewCenter = display2d.viewCenterPixel();
+        sprite.x = centerx*display2d.PTM + viewCenter.x;
+        sprite.y = -centery*display2d.PTM + viewCenter.y;
+        display2d.stage.addChild( sprite );
     }
 
     var createWall = function(centerx, centery, horizontal, vertical, dontTouch) {