From 0fb9807613291cec289e542d1aa2cbddbd22c5ab Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 3 Sep 2009 16:49:21 +1000 Subject: Close dialogs if they press new game Also only has one dialog shown when you win. --- demos/declarative/samegame/content/samegame.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js index 9914edb..0a3a4db 100755 --- a/demos/declarative/samegame/content/samegame.js +++ b/demos/declarative/samegame/content/samegame.js @@ -34,6 +34,10 @@ function initBoard() maxY = Math.floor(gameCanvas.height/tileSize); maxIndex = maxY*maxX; + //Close dialogs + scoreName.forceClose(); + dialog.forceClose(); + //Initialize Board board = new Array(maxIndex); gameCanvas.score = 0; @@ -144,10 +148,11 @@ function victoryCheck() gameCanvas.score += 500; //Checks for game over if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))){ - dialog.show("Game Over. Your score is " + gameCanvas.score); timer = new Date() - timer; if(scoresURL != "") - scoreName.show("Please enter your name: "); + scoreName.show("You've won! Please enter your name: "); + else + dialog.show("Game Over. Your score is " + gameCanvas.score); } } -- cgit v0.12