Platformer with Level Editor
import QtQuick 2.0
import Felgo 3.0
import "../../common"
DialogBase {
id: finishDialog
closeableByClickOnBackground: false
property real score
Text {
anchors.centerIn: parent
anchors.verticalCenterOffset: -20
text: "Finished!"
color: "white"
}
Text {
anchors.centerIn: parent
text: "Score: " + score
color: "white"
}
Text {
anchors.centerIn: parent
anchors.verticalCenterOffset: 20
property var currentLeaderboard: {
if(levelEditor.currentLevelData.levelMetaData) {
if(levelEditor.currentLevelData.levelMetaData.id)
return levelEditor.currentLevelData.levelMetaData.id
else if(levelEditor.currentLevelData.levelMetaData.publishedLevelId)
return levelEditor.currentLevelData.levelMetaData.publishedLevelId
}
return undefined
}
text: "Your Highscore: " + gameNetwork.userHighscoreForLeaderboard(currentLeaderboard)
+ " (#" + gameNetwork.userPositionForLeaderboard(currentLeaderboard) + ")"
color: "#80bfff"
visible: currentLeaderboard !== undefined
}
PlatformerTextButton {
id: okButton
screenText: "Restart"
width: 100
anchors.bottom: parent.bottom
anchors.bottomMargin: 50
anchors.left: parent.left
anchors.leftMargin: 100
onClicked: {
finishDialog.opacity = 0
gameScene.state = "play"
gameScene.resetLevel()
}
}
PlatformerTextButton {
id: cancelButton
screenText: "Menu"
width: 100
anchors.bottom: parent.bottom
anchors.bottomMargin: 50
anchors.right: parent.right
anchors.rightMargin: 100
onClicked: {
finishDialog.opacity = 0
gameScene.state = "play"
gameScene.backPressed()