summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-09-03 06:49:21 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-09-03 06:49:21 (GMT)
commit0fb9807613291cec289e542d1aa2cbddbd22c5ab (patch)
tree6e1833eadefb5900a01c068cc7603ca5a30fc60a
parentcece4361fc7048272c251ba19bb78fe236fc01c1 (diff)
downloadQt-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.
-rwxr-xr-xdemos/declarative/samegame/content/samegame.js9
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);
}
}