Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

ChickenOutbreak2 Demo

 import Felgo 4.0
 import QtQuick 2.0

 Item {
   anchors.fill: parent

   visible: false

   enabled: visible

   signal saveIt()
   signal killIt()
   signal activated()
   signal deactivated()

   property int yOffset: 60

   function setActive() {
     visible = true
     countdown.countdown = 5
     countdownTimer.restart()
     activated()
   }

   function setDissable() {
     visible = false
     deactivated()
   }

   Image {
     id: blackbg
     source: Qt.resolvedUrl("../assets/blackbg.png")
     width: scene.gameWindowAnchorItem.width
     height: scene.gameWindowAnchorItem.height
     x: scene.gameWindowAnchorItem.x
     y: scene.gameWindowAnchorItem.y
   }

   MouseArea {
     anchors.fill: blackbg
     onClicked: {
       countdown.countdown--
       audioManager.play(audioManager.idTICK)
       if(countdown.countdown<=0) {
         countdownTimer.stop()
         killIt()
       }
     }
   }

   Item {
     id: descriptionItem
     anchors.horizontalCenter: parent.horizontalCenter
     y:80+yOffset
     //z:19
     width: signDescription.width
     height: signDescription.height

     Image {
       id: signDescription
       source: Qt.resolvedUrl("../assets/sign.png")
       width: 150
       height: 120
       mirror: true
     }

     CoinDisplay {
       id: saveItButton
       y: 82
       anchors.left: parent.left
       anchors.leftMargin: 20
       rotation: 2
       customCoins: store.saveit.balance
       displayCustomCoins: true
     }

     MenuText {
       y: 82
       anchors.left: saveItButton.right
       anchors.leftMargin: 10
       rotation: 2
       text: qsTr("Call Angel")
       font.pixelSize: 22
     }

     MouseArea {
       anchors.fill: parent
       onClicked: {
         audioManager.play(audioManager.idMENUCLICK)
         playNBuy()
         parent.scale = 1.0
       }
       onPressed: {
         parent.scale = 0.85
       }
       onReleased: {
         parent.scale = 1.0
       }
       onCanceled: {
         parent.scale = 1.0
       }
     }
   }

   Image {
     id: signCountdown
     source: Qt.resolvedUrl("../assets/sign.png")
     anchors.horizontalCenter: parent.horizontalCenter
     y: -118+yOffset
     width: 300
     height: 270
     //z: 20
   }

   MenuText {
     id: countdown
     anchors.top: signCountdown.top
     anchors.topMargin: 167
     anchors.horizontalCenter: signCountdown.horizontalCenter
     property int countdown: 0
     text: " ( "+countdown.countdown+" ) "
     font.pixelSize: 55
     rotation: -1.5
   }

   MenuText {
     id: headline
     anchors.bottom: signCountdown.bottom
     anchors.bottomMargin: 20
     anchors.horizontalCenter: signCountdown.horizontalCenter
     rotation: -1.5
     text: qsTr("Time to rescue hen")
     font.pixelSize: 22
   }

   Timer {
     id: countdownTimer
     interval: 1000
     repeat: true
     onTriggered: {
       countdown.countdown--
       audioManager.play(audioManager.idTICK)
       if(countdown.countdown<=0) {
         stop()
         killIt()
       }
     }
   }

   CurrencyPackPage {
     id: currencyPackPage
     opacity: 0
     isMoney: false
     z:22

     onBoughtPack: {
       countdownTimer.start()
     }

     onClosed: {
       countdownTimer.start()
     }
   }

   function playNBuy() {
     if(store.saveit.balance > 0) {
       store.takeItem("currency_saveit_id",1)
       countdownTimer.stop()
       saveIt()
       deactivated()
     } else {
       countdownTimer.stop()
       currencyPackPage.opacity = 1
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded