summaryrefslogtreecommitdiffstats
path: root/demos/declarative/snake/snake.qml
diff options
context:
space:
mode:
Diffstat (limited to 'demos/declarative/snake/snake.qml')
-rw-r--r--demos/declarative/snake/snake.qml41
1 files changed, 29 insertions, 12 deletions
diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml
index af86aac..585c0b2 100644
--- a/demos/declarative/snake/snake.qml
+++ b/demos/declarative/snake/snake.qml
@@ -88,7 +88,7 @@ Rectangle {
onTriggered: { Logic.moveSkull() }
}
Timer {
- id: startNewGameTimer;
+ id: startNewGameTimer;
interval: 700;
onTriggered: { Logic.startNewGame(); }
}
@@ -109,6 +109,7 @@ Rectangle {
}
Image {
+
Image {
id: title
source: "content/pics/snake.jpg"
@@ -117,14 +118,28 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
- Text {
- color: "white"
- font.pointSize: 24
- horizontalAlignment: Text.AlignHCenter
- text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore;
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- anchors.bottomMargin: gridSize
+ Column {
+ spacing: 140
+ anchors.verticalCenter: parent.verticalCenter;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+
+ Text {
+ color: "white"
+ font.pointSize: 48
+ font.italic: true;
+ font.bold: true;
+ text: "Snake"
+ anchors.horizontalCenter: parent.horizontalCenter;
+ }
+
+ Text {
+ color: "white"
+ font.pointSize: 24
+ anchors.horizontalCenter: parent.horizontalCenter;
+ //horizontalAlignment: Text.AlignHCenter
+ text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore;
+ }
}
}
@@ -154,7 +169,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
onPressed: {
- if (!head || !heartbeat.running) {
+ if (screen.state == "") {
Logic.startNewGame();
return;
}
@@ -245,10 +260,12 @@ Rectangle {
from: "*"
to: "starting"
NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 }
- NumberAnimation { target: title; property: "opacity"; duration: 500 }
+ NumberAnimation { property: "opacity"; duration: 200 }
},
Transition {
- NumberAnimation { target: title; property: "opacity"; duration: 500 }
+ to: "starting"
+ NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 }
+ NumberAnimation { property: "opacity"; duration: 200 }
}
]