﻿var Game = Game || (function (createjs, $) {

    function Game(canvasId, gameData) {

        //var assetsPath = gameData.assetsPath || "";
        gameData = gameData || {};
        var self = this;
        var mouseBp;
        var stage = new createjs.Stage(canvasId);

        stage.enableMouseOver(10);
       // stage.mouseMoveOutside = true;

        var fps = 60;
        var tickCount = 0;
        var currentArea = null;

        var xCord = 0;
        var yCord = 0;
        var colors = ["pink", "blue", "red", "orange"];
        
        for (x = 0; x < 10;x++)
        {
            for (y = 0; y < 10; y++)
            {
                var randomNum = Math.floor((Math.random() * 4) + 0);
                var circle = new createjs.Shape();
                circle.graphics.beginFill(colors[randomNum]).drawCircle(xCord,yCord, 10);
                circle.x =  xCord;
                circle.y =  yCord;
                yCord += 10;
                
                var dragger = new createjs.Container();
             //   dragger.x = dragger.y = 10;
                dragger.addChild(circle);
                stage.addChild(dragger);
                dragger.on("mousedown", function (evt) {
                    //a record on the offset between the mouse position and the container
                    // position. currentTarget will be the container that the event listener was added to:
                    evt.currentTarget.offset = { x: this.x - evt.stageX, y: this.y - evt.stageY };
                });
                dragger.on("pressmove", function (evt) {
                    // Calculate the new X and Y based on the mouse new position plus the offset.
                    evt.currentTarget.x = evt.stageX + evt.currentTarget.offset.x;
                    evt.currentTarget.y = evt.stageY + evt.currentTarget.offset.y;

                });
            }
            //
            yCord = 0;
            xCord += 10;
            stage.update();
            createjs.Ticker.addEventListener("tick", stage);
        }
      
        
    }
    return Game;
})(createjs, $);
@@ -426,16 +426,50 @@
  null;%0A%0A
+        var shape = new Array();%0A%0A
         
@@ -985,29 +985,132 @@
             
-%0A    
+shape(x) = circle;%0A%0A            %7D%0A            //%0A            yCord = 0;%0A            xCord += 10;%0A        %7D%0A%0A
             
@@ -1162,17 +1162,16 @@
         
- 
 //   dra
@@ -1200,36 +1200,32 @@
 0;%0D%0A            
-   
- 
 dragger.addChild
@@ -1243,28 +1243,24 @@
             
-    
 stage.addChi
@@ -1277,36 +1277,32 @@
 );%0D%0A            
-   
- 
 dragger.on(%22mous
@@ -1319,36 +1319,32 @@
 nction (evt) %7B%0D%0A
-    
                 
@@ -1430,20 +1430,16 @@
         
-  
-  
 // posit
@@ -1526,36 +1526,32 @@
                 
-    
 evt.currentTarge
@@ -1630,21 +1630,13 @@
     
-  
-  
 %7D);%0D%0A
-    
     
@@ -1701,20 +1701,16 @@
         
-  
-  
 // Calcu
@@ -1788,36 +1788,32 @@
                 
-    
 evt.currentTarge
@@ -1868,36 +1868,32 @@
                 
-  
-  
 evt.currentTarge
@@ -1954,20 +1954,16 @@
         
-    
 %7D);%0A    
@@ -1971,80 +1971,9 @@
     
- 
-  %7D
 %0A
-            //%0A            yCord = 0;%0A            xCord += 10;%0A    
     
@@ -1989,28 +1989,24 @@
 .update();%0D%0A
-    
         crea
@@ -2054,25 +2054,8 @@
 e);%0A
-        %7D%0A      %0A
     

sort the code to understand better