TutorialScene.qml Example File

demos/ChickenOutbreak2/qml/TutorialScene.qml
 import QtQuick 2.0
 import Felgo 3.0

 // gets displayed when the game is lost, and shows the reached score and if there was a new highscore reached
 SceneBase {

   property int slideNum : 1

   signal finished

   Component.onCompleted: opacity = 1

   onBackButtonPressed: {
     audioManager.play(audioManager.idMENUCLICK)
     if(slideNum > 1) {
       slideNum--
     } else {
       if(windowMainItem.lastState === "gameOver") {
         window.state = "gameOver"
       } else {
         window.state = "main"
       }
     }

   }

   // 3 different formats of the image are provided (-sd, -hd and -hd2)
   MultiResolutionImage {
     source: "../assets/background-wood2.png"
     anchors.centerIn: parent
   }

   Image {
     source: "../assets/sign.png"
     anchors.horizontalCenter: parent.horizontalCenter
     y: -110
     width: 230
     height: 200
     z: 10
   }

   Image {
     source: "../assets/sign.png"
     anchors.horizontalCenter: parent.horizontalCenter
     y: 10
     width: 210
     height: 170
     z: 9
     mirror: true
   }

   Image {
     source: "../assets/sign.png"
     anchors.horizontalCenter: parent.horizontalCenter
     y: 115
     width: 210
     height: 170
     z: 8
   }

   Image {
     source: "../assets/sign.png"
     visible: slideNum === 2
     anchors.horizontalCenter: parent.horizontalCenter
     y: 220
     width: 210
     height: 170
     z: 7
     mirror: true
   }

   MenuButton {
     anchors.bottom: parent.bottom
     anchors.bottomMargin: 20
     anchors.horizontalCenter: parent.horizontalCenter
     height: 40
     text: qsTr("Continue")
     onClicked: nextSlide()
   }

   // ----------- PARACHUTE ---------------
   Item {
     z: 15
     visible: slideNum === 1
     width: parent.width
     height: parent.height
     Image {
       source: "../assets/parachute.png"
       anchors.verticalCenter: parachuteTitle.verticalCenter
       anchors.right: parachuteTitle.left
       anchors.rightMargin: 10
       width: 40
       height: 40
     }
     MenuText {
       id: parachuteTitle
       text: qsTr("Parachute")
       y: 24
       anchors.horizontalCenter: parent.horizontalCenter
       font.pixelSize: 34
       rotation: -2
     }
     MenuText {
       id: startPar
       y: 126
       text: qsTr("Start parachute")
       rotation: 2
       font.pixelSize: 25
       anchors.horizontalCenter: system.desktopPlatform ? undefined : parent.horizontalCenter
       x: system.desktopPlatform ? 135 : 0
     }
     Image {
       source: system.desktopPlatform ? "../assets/button_space.png" : "../assets/touch.png"
       anchors.verticalCenter: startPar.verticalCenter
       anchors.right: startPar.left
       anchors.rightMargin: 5
       width: system.desktopPlatform ? 50 : 30
       height: system.desktopPlatform ? 96 : 57
     }
     MenuText {
       id: stopPar
       y: 234
       text: qsTr("Stop parachute")
       rotation: -2
       font.pixelSize: 25
       anchors.horizontalCenter: system.desktopPlatform ? undefined : parent.horizontalCenter
       x: system.desktopPlatform ? 135 : 0
     }
     Image {
       source: system.desktopPlatform ? "../assets/button_space.png" : "../assets/touch.png"
       anchors.verticalCenter: stopPar.verticalCenter
       anchors.right: stopPar.left
       anchors.rightMargin: 5
       width: system.desktopPlatform ? 50 : 30
       height: system.desktopPlatform ? 96 : 57
     }
   }
   // ----------- TELEPORT ---------------
   Item {
     z: 15
     visible: slideNum === 2
     width: parent.width
     height: parent.height
     Image {
       source: "../assets/teleport.png"
       anchors.verticalCenter: teleportTitle.verticalCenter
       anchors.right: teleportTitle.left
       anchors.rightMargin: 10
       width: 50
       height: 40
     }
     MenuText {
       id: teleportTitle
       y: 24
       anchors.horizontalCenter: parent.horizontalCenter
       text: qsTr("Teleport")
       font.pixelSize: 34
       rotation: -2
     }
     MenuText {
       id: stopTime
       visible: slideNum === 2
       y: 126
       anchors.horizontalCenter: parent.horizontalCenter
       text: qsTr("Stop time")
       rotation: 2
       font.pixelSize: 25
     }
     Image {
       source: system.desktopPlatform ? "../assets/button_up.png" : "../assets/swipe_up.png"
       anchors.verticalCenter: stopTime.verticalCenter
       anchors.right: stopTime.left
       anchors.rightMargin: 5
       width: 30
       height: 57
     }
     MenuText {
       id: tpToDest
       y: 237
       anchors.horizontalCenter: parent.horizontalCenter
       text: qsTr("Teleport to destination")
       rotation: -2
       font.pixelSize: 20
     }
     Image {
       source: system.desktopPlatform ? "../assets/click.png" : "../assets/touch.png"
       anchors.verticalCenter: tpToDest.verticalCenter
       anchors.right: tpToDest.left
       anchors.rightMargin: 5
       width: 30
       height: 57
     }
     MenuText {
       id: resumeTime
       y: 336
       anchors.horizontalCenter: parent.horizontalCenter
       text: qsTr("Resume time")
       rotation: 2
       font.pixelSize: 25
     }
     Image {
       source: system.desktopPlatform ? "../assets/button_down.png" : "../assets/swipe_down.png"
       anchors.verticalCenter: resumeTime.verticalCenter
       anchors.right: resumeTime.left
       anchors.rightMargin: 5
       width: 30
       height: 57
     }
   }

   MenuText {
     visible: slideNum === 3
     anchors.centerIn: parent
     text: "slide3"
   }

   function nextSlide() {
     audioManager.play(audioManager.idMENUCLICK)
     slideNum++
     if(slideNum > 2) {
       settings.setValue("firstAppStart",1)
       firstAppStart = false
       opacity = 0
       if(windowMainItem.lastState === "gameOver") {
         window.state = "gameOver"
       } else {
         window.state = "game"
       }
       //finished()
     }
   }

   function enterScene() {}

   //onSlideNumChanged: console.debug("slideNum changed to " +slideNum)
 }

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