===================================================================
--- original.js
+++ change.js
@@ -59,8 +59,12 @@
game.down = function (x, y, obj) {
balls.forEach(function (ball) {
if (ball.intersects(obj)) {
ball.pop();
+ balls = balls.filter(function (item) {
+ return item !== ball;
+ }); // remove the ball from the array
+ ball.destroy(); // destroy the ball
}
});
};
// Update function to move balls