ChickenOutbreak2 Demo
import QtQuick 2.0
Item {
width: 180
height: 25
opacity: 0
property int count: 10
property int itemType: 0
Image {
source: Qt.resolvedUrl("../assets/button.png")
width: 180
height: 25
}
Image {
source: Qt.resolvedUrl("../assets/coin_single.png")
width: 15.25
height: 20
x: 15
y: 2
visible: itemType === 0
}
Image {
source: Qt.resolvedUrl("../assets/parachute.png")
width: 20
height: 20
x: 15
y: 2
visible: itemType === 1
}
Image {
source: Qt.resolvedUrl("../assets/teleport.png")
width: 20
height: 20
x: 15
y: 2
visible: itemType === 2
}
Text {
color: "#f1ed00"
font.family: fontHUD.name
font.pixelSize: 20
x: 45
text: qsTr("plus ") + count + qsTr(" daily bonus")
}
function giveBonus() {
giveBonusDelay.start()
}
function giveBonusAfterDelay() {
var item = Math.random()
if(item < 0.44) {
count = 1
itemType = 1
parachuteCount++
audioManager.play(audioManager.idPARACHUTE)
} else if(item >0.44 && item < 0.77) {
count = 1
itemType = 2
teleportCount++
audioManager.play(audioManager.idTELEPORT)
} else {
count = 10
itemType = 0
store.giveItem("currency_money_id",count)
audioManager.play(audioManager.idPLING)
}
opacity = 1
displayTimer.start()
}
Timer {
id: displayTimer
interval: 5000
running: false
onTriggered: parent.opacity = 0
}
Timer {
id: giveBonusDelay
interval: 1000
running: false
onTriggered: giveBonusAfterDelay()
}
Behavior on opacity {
NumberAnimation{duration: 500}
}
MouseArea {
anchors.fill: parent
onClicked: {
parent.opacity = 0