diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-09-03 06:49:21 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-09-03 06:49:21 (GMT) |
commit | 0fb9807613291cec289e542d1aa2cbddbd22c5ab (patch) | |
tree | 6e1833eadefb5900a01c068cc7603ca5a30fc60a /demos/declarative/samegame | |
parent | cece4361fc7048272c251ba19bb78fe236fc01c1 (diff) | |
download | Qt-0fb9807613291cec289e542d1aa2cbddbd22c5ab.zip Qt-0fb9807613291cec289e542d1aa2cbddbd22c5ab.tar.gz Qt-0fb9807613291cec289e542d1aa2cbddbd22c5ab.tar.bz2 |
Close dialogs if they press new game
Also only has one dialog shown when you win.
Diffstat (limited to 'demos/declarative/samegame')
-rwxr-xr-x | demos/declarative/samegame/content/samegame.js | 9 |
1 files 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); } } |