Crazy Carousel Game
import Felgo 4.0
import QtQuick 2.0
import "scenes"
GameWindow {
id: gameWindow
screenWidth: 320
screenHeight: 480
EntityManager {
id: entityManager
entityContainer: gameScene
}
TitleScene {
id: titleScene
onBackButtonPressed: {
NativeUtils.displayMessageBox("Really quit the game?", "", 2)
}
Connections {
target: NativeUtils
function onMessageBoxFinished(accepted) {
if(accepted && gameWindow.activeScene === titleScene)
Qt.quit()
}
}
}
GameScene {
id: gameScene
onBackButtonPressed: {
gameWindow.state = "title"
}
}
GameOverScene {
id: gameOverScene
onBackButtonPressed: {
NativeUtils.displayMessageBox("Really quit the game?", "", 2)
}
Connections {
target: NativeUtils
function onMessageBoxFinished(accepted) {
if(accepted && gameWindow.activeScene === gameOverScene)
Qt.quit()
}
}
}
state: "title"
states: [
State {
name: "title"
PropertyChanges {target: titleScene; opacity: 1}
PropertyChanges {target: gameWindow; activeScene: titleScene}
},
State {
name: "game"
PropertyChanges {target: gameScene; opacity: 1}
PropertyChanges {target: gameWindow; activeScene: gameScene}
},
State {
name: "gameover"
PropertyChanges {target: gameOverScene; opacity: 1}
PropertyChanges {target: gameWindow; activeScene: gameOverScene}
}