Doodle Jump Game
import QtQuick 2.0
import Felgo 4.0
import QtSensors 5.5
import "../"
SceneBase {
id: gameScene
width: 320
height: 480
state: "start"
property int score: 0
signal menuScenePressed
Component.onCompleted: gameNetwork.incrementAchievement("5opens")
Image {
anchors.fill: parent.gameWindowAnchorItem
source: Qt.resolvedUrl("../../assets/background.png")
}
Keys.forwardTo: frog.controller
Accelerometer {
id: accelerometer
active: true
}
PhysicsWorld {
debugDrawVisible: false
updatesPerSecondForPhysics: 60
gravity.y: 20
}
Repeater {
model: 10
Platform {
x: utils.generateRandomValueBetween(0, gameScene.width)
y: gameScene.height / 10 * index
}
}
Platform {
x: 120
y: 300
}
Frog {
id: frog
x: gameScene.width / 2
y: 220
}
Border {
id: border
x: -gameScene.width*2
y: gameScene.height-10
}
Image {
id: scoreCounter
source: Qt.resolvedUrl("../../assets/scoreCounter.png")
height: 80
x: -15
y: -15
Text {
id: scoreText
anchors.centerIn: parent
color: "white"
font.pixelSize: 32
text: score
}
}
MouseArea {
id: mouseArea
anchors.fill: gameScene.gameWindowAnchorItem
onClicked: {
if(gameScene.state === "start") {
gameScene.state = "playing"
}
if(gameScene.state === "gameOver")
{
gameScene.state = "start"
}
}
}
Image {
id: infoText
anchors.centerIn: parent
source: gameScene.state == "gameOver" ? "../../assets/gameOverText.png" : "../../assets/clickToPlayText.png"
visible: gameScene.state !== "playing"
}
Image {
id: menuButton
source: Qt.resolvedUrl("../../assets/optionsButton.png")
x: gameScene.width - 96
y: -40
scale: 0.5
MouseArea {
id: menuButtonMouseArea
anchors.fill: parent
onClicked: {
menuScenePressed()
frog.die()
gameScene.state = "start"
}