Platformer with Level Editor
import QtQuick 2.0
import Felgo 3.0
Item {
id: levelGrid
anchors.top: levelScene.state == "demoLevels" ? mainBar.bottom : subBar.bottom
anchors.bottom: levelScene.gameWindowAnchorItem.bottom
anchors.left: levelScene.left
anchors.right: levelScene.right
anchors.margins: 5
anchors.topMargin: 0
anchors.bottomMargin: 0
property var levelMetaDataArray
property bool isLoading: false
onLevelMetaDataArrayChanged: {
if(!isLoading) {
levelListRepeater.model = levelMetaDataArray
}
}
Flickable {
id: levelGridFlickable
anchors.fill: parent
clip: true
contentWidth: grid.width
contentHeight: grid.height + 2 * offset.height
flickableDirection: Flickable.VerticalFlick
Item {
id: offset
width: parent.width
height: 5
anchors.top: parent.top
}
Grid {
id: grid
anchors.top: offset.bottom
columns: 4
spacing: 10
Repeater {
id: levelListRepeater
delegate: LevelSelectionItem {}
}
}
}
Text {
id: loadingText
text: "Loading"
visible: isLoading
anchors.centerIn: parent
anchors.verticalCenterOffset: -40
font.family: marioFont.name
font.pixelSize: 40
color: "#fff833"
style: Text.Outline
styleColor: "black"
}
Timer {
id: loadingTimer
interval: 1000
onTriggered: finishLoading()
}
function startLoading() {
levelListRepeater.model = null
isLoading = true
loadingTimer.start()
}
function finishLoading() {
isLoading = false