summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials/samegame/samegame2/samegame.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/tutorials/samegame/samegame2/samegame.js')
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/samegame.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js
index 2c02c61..0ec3a8b 100644
--- a/examples/declarative/tutorials/samegame/samegame2/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js
@@ -15,6 +15,12 @@ function index(xIdx,yIdx) {
function initBoard()
{
+ //Delete old blocks
+ for(var i = 0; i<maxIndex; i++){
+ if(board[i] != null)
+ board[i].destroy();
+ }
+
//Calculate board size
maxX = Math.floor(background.width/tileSize);
maxY = Math.floor(background.height/tileSize);