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
 import QtMultimedia 5.0

 Item {
   id: audioManager

   // Use Sound IDs to play Sounds e.g. SoundEffectManager.play(SoundEffectManager.idBADCORN)
   property int idBADCORN: 11
   property int idCORN: 22
   property int idGAMEOVER: 33
   property int idMENUCLICK: 44
   property int idPARACHUTE: 55
   property int idPLING: 66
   property int idPOWERUP: 77
   property int idSLOWMO: 88
   property int idSLOWMOOFF: 99
   property int idTELEPORT: 111
   property int idTICK: 222

   property bool toggleCORN

   // Use Music IDs to play Music. e.g. SoundEffectManager.playMusic(SoundEffectManager.idMusicBG)
   property int idMusicBG: 111

   function play(clipID) {
     // if settings disable do not play sounds
     if(!settings.soundEnabled)
       return

     switch(clipID) {
     case idBADCORN:
       clipBADCORN.play()
       break
     case idCORN:
       if(toggleCORN) clipCORN_1.play()
       else clipCORN_2.play()
       toggleCORN = !toggleCORN
       break
     case idGAMEOVER:
       clipGAMEOVER.play()
       break
     case idMENUCLICK:
       clipMENUCLICK.play()
       break
     case idPARACHUTE:
       clipPARACHUTE.play()
       break
     case idPLING:
       clipPLING.play()
       break
     case idPOWERUP:
       clipPOWERUP.play()
       break
     case idSLOWMO:
       clipSLOWMO.play()
       break
     case idSLOWMOOFF:
       clipSLOWMOOFF.play()
       break
     case idTELEPORT:
       clipTELEPORT.play()
       break
     case idTICK:
       clipTICK.play()
       break
     }
   }

   function playMusic(trackID) {
     // if settings disable do not play sounds
     if(!settings.musicEnabled)
       return

     switch(trackID) {
     case idMusicBG:
       music.source = Qt.resolvedUrl("../assets/snd/bg-new.wav")
       break
     }

     music.play()
   }

   function stopMusic() {
     music.stop()
   }

   BackgroundMusic {
     id: music
   }

   GameSoundEffect {
     id: clipBADCORN
     source: Qt.resolvedUrl("../assets/snd/badCoin.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipCORN_1
     source: Qt.resolvedUrl("../assets/snd/corn.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipCORN_2
     source: Qt.resolvedUrl("../assets/snd/corn.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipGAMEOVER
     source: Qt.resolvedUrl("../assets/snd/gameOver.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipMENUCLICK
     source: Qt.resolvedUrl("../assets/snd/menuclick.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipPARACHUTE
     source: Qt.resolvedUrl("../assets/snd/parachute.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipPLING
     source: Qt.resolvedUrl("../assets/snd/pling.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipPOWERUP
     source: Qt.resolvedUrl("../assets/snd/powerup.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipSLOWMO
     source: Qt.resolvedUrl("../assets/snd/SlowMo.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipSLOWMOOFF
     source: Qt.resolvedUrl("../assets/snd/SlowMoOut.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipTELEPORT
     source: Qt.resolvedUrl("../assets/snd/teleport.wav")
     volume: 1
   }
   GameSoundEffect {
     id: clipTICK
     source: Qt.resolvedUrl("../assets/snd/tick.wav")
     volume: 1
   }

   Component.onCompleted: {
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded