summaryrefslogtreecommitdiffstats
path: root/demos/declarative/snake/content
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-08-16 08:11:20 (GMT)
committermae <qt-info@nokia.com>2010-08-16 08:12:42 (GMT)
commitaf675cf96d4d13b066a669eae847ad56485927d0 (patch)
treefcc3cfdc6b27c03e8ccb5385a4c830f22e317611 /demos/declarative/snake/content
parentb83c295650b3f28bc9da542acf4652f4ce2d168b (diff)
downloadQt-af675cf96d4d13b066a669eae847ad56485927d0.zip
Qt-af675cf96d4d13b066a669eae847ad56485927d0.tar.gz
Qt-af675cf96d4d13b066a669eae847ad56485927d0.tar.bz2
Fix game could not be restarted
Task-number: QT-3668
Diffstat (limited to 'demos/declarative/snake/content')
-rw-r--r--demos/declarative/snake/content/snake.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 0f0dbf7..fab7834 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -35,9 +35,12 @@ function startNewGame()
if (heartbeat.running) {
endGame();
startNewGameTimer.running = true;
+ state = "starting";
return;
}
+ state = "starting";
+
numRows = numRowsAvailable;
numColumns = numColumnsAvailable;
board = new Array(numRows * numColumns);
@@ -80,7 +83,6 @@ function startNewGame()
waitForCookie = 5;
score = 0;
startHeartbeatTimer.running = true;
- heartbeat.running = true;
}
function endGame()
@@ -94,6 +96,7 @@ function endGame()
}
lastScore = score;
highScores.saveScore(lastScore);
+ state = "";
}
function move() {