Commits

abrie  committed 0574129

reset sequence when level is reloaded

  • Participants
  • Parent commits 39614dd

Comments (0)

Files changed (1)

         2: 0x00FF00,
     }
 
-    var ballPosition = 1;
+    var ballPosition = 0;
     var addBall = function(ballType) {
         var ball = createBallModel( ballTypes[ballType] );
+        balls.push(ball);
         scene.add(ball);
         var position = { x : 0, y: 0, z:200 };
         var target = { x : -15+5*(ballPosition++), y: -14, z:100 };
     }
 
     var state = [];
+    var balls = [];
     var objectiveIndex = 0;
     var objective = undefined;
     var loadWorld = function(level) {
+        balls.forEach( function(ball) { 
+            scene.remove(ball);
+        });
+        ballPosition = 0
         state.length = 0;
         objective = level.objective;
     }