SelectLevelScene.qml Example File

demos/MultiSceneMultiLevel/qml/scenes/SelectLevelScene.qml
 import Felgo 3.0
 import QtQuick 2.0
 import "../common"

 SceneBase {
   id: selectLevelScene

   // signal indicating that a level has been selected
   signal levelPressed(string selectedLevel)

   // background
   Rectangle {
     anchors.fill: parent.gameWindowAnchorItem
     color: "#ece468"
   }

   // back button to leave scene
   MenuButton {
     text: "Back"
     // anchor the button to the gameWindowAnchorItem to be on the edge of the screen on any device
     anchors.right: selectLevelScene.gameWindowAnchorItem.right
     anchors.rightMargin: 10
     anchors.top: selectLevelScene.gameWindowAnchorItem.top
     anchors.topMargin: 10
     onClicked: backButtonPressed()
   }

   // levels to be selected
   Grid {
     anchors.centerIn: parent
     spacing: 10
     columns: 5
     MenuButton {
       text: "1"
       width: 50
       height: 50
       onClicked: {
         levelPressed("Level1.qml")
       }
     }
     MenuButton {
       text: "2"
       width: 50
       height: 50
       onClicked: {
         levelPressed("Level2.qml")
       }
     }
     MenuButton {
       text: "3"
       width: 50
       height: 50
       onClicked: {
         levelPressed("Level3.qml")
       }
     }
     Repeater {
       model: 10
       MenuButton {
         text: " "
         width: 50
         height: 50
       }
     }
   }
 }

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support