Commits

abrie  committed 38f1d0f

label out of bounds pieces with an x

  • Participants
  • Parent commits 4b83210

Comments (0)

Files changed (2)

             var sprite = actor.body.userData.sprite;
             sprite.x = position.get_x()*display2d.PTM + viewCenter.x;
             sprite.y = -position.get_y()*display2d.PTM + viewCenter.y;
+            var sprite2 = actor.body.userData.sprite2;
+            if( sprite2 ) {
+                sprite2.x = position.get_x()*display2d.PTM + viewCenter.x;
+                sprite2.y = -position.get_y()*display2d.PTM + viewCenter.y;
+            }
         });
     }
 
     }
 
     var layers = {
-        1:[],2:[],3:[]
+        1:[],2:[],3:[],4:[]
     }
 
     var queueSprite = function(layer, sprite) {
         forEach(layers[1]);
         forEach(layers[2]);
         forEach(layers[3]);
+        forEach(layers[4]);
     }
 
     var createBall = function(ballType,x,y) {
                 isBall:true,
                 ballType:ballType,
             },
-            sprite:createBallSprite(radius, colors.r,colors.g,colors.b)
+            sprite:createBallSprite(radius, colors.r,colors.g,colors.b),
+            sprite2:createMarkSprite("tinyx.png")
         });
         queueSprite(2,ball.body.userData.sprite);
+        queueSprite(4,ball.body.userData.sprite2);
         actors.push( ball );
         return ball;
     }
 
+    var createMarkSprite = function(filename) {
+        var data = {
+            images: [filename],
+            frames: {width:30, height:30, regX:15, regY:15},
+            animations: {
+                on: {
+                    frames: [0],
+                },
+                off: {
+                    frames: [],
+                },
+            }
+        };
+        var spriteSheet = new createjs.SpriteSheet(data);
+        var animation = new createjs.BitmapAnimation(spriteSheet);
+        animation.gotoAndPlay("off");
+        return animation;
+    }
+
     var createWarpHoleSprite = function(filename) {
         var data = {
             images: [filename],
             }
             else if( fixtureToUserData(a).attributes.isWall ) {
                 if( fixtureToUserData(a).attributes.dontTouch ) {
+                    fixtureToUserData(b).sprite2.gotoAndPlay("on");
                     notifyObjective(false);
                 }
             }
             }
             else if( fixtureToUserData(b).attributes.isWall ) {
                 if( fixtureToUserData(b).attributes.dontTouch ) {
+                    fixtureToUserData(a).sprite2.gotoAndPlay("on");
                     notifyObjective(false);
                 }
             }

File tinyx.png

Added
New image