Durdles - 2-Player Action Game
import Felgo 4.0
import QtQuick 2.0
import "scenes"
import "levels"
import "common"
GameWindow {
screenHeight: 960
screenWidth: 640
id: window
Rectangle {
id: background
color: "white"
anchors.fill: parent
}
EntityManager {
id: entityManager
entityContainer: gameScene
}
FontLoader {
id: standardFont
source: Qt.resolvedUrl("fonts/bubblegum.ttf")
}
MenuScene {
id: menuScene
onSelectLevelPressed: window.state = "selectLevel"
onCreditsPressed: window.state = "credits"
onSettingsPressed: window.state = "settings"
onBackButtonPressed: {
NativeUtils.displayMessageBox(qsTr("Really quit the game?"), "", 2);
}
Connections {
target: NativeUtils
function onMessageBoxFinished(accepted) {
if (accepted) {
Qt.quit()
}
}
}
}
SelectLevelScene {
id: selectLevelScene
onLevelPressed: selectedLevel => {
gameScene.setLevel(selectedLevel)
window.state = "game"
}
onBackButtonPressed: window.state = "menu"
}
CreditsScene {
id: creditsScene
onBackButtonPressed: window.state = "menu"
}
SettingScene {
id: settingScene
onBackButtonPressed: window.state = "menu"
}
GameScene {
id: gameScene
onBackButtonPressed: window.state = "selectLevel"
}
state: "menu"
activeScene: menuScene
states: [
State {
name: "menu"
PropertyChanges {target: menuScene; opacity: 1}
PropertyChanges {target: window; activeScene: menuScene}
},
State {
name: "selectLevel"
PropertyChanges {target: selectLevelScene; opacity: 1}
PropertyChanges {target: window; activeScene: selectLevelScene}
},
State {
name: "credits"
PropertyChanges {target: creditsScene; opacity: 1}
PropertyChanges {target: window; activeScene: creditsScene}
},
State {
name: "settings"
PropertyChanges {target: settingScene; opacity: 1}
PropertyChanges {target: window; activeScene: settingScene}
},
State {
name: "game"
PropertyChanges {target: gameScene; opacity: 1}
PropertyChanges {target: window; activeScene: gameScene}