ChickenOutbreak2 Demo
import QtQuick 2.0
import Felgo 4.0
Item {
Image {
source: Qt.resolvedUrl("../assets/window3.png")
width: 64
height: 60
x: 225
y: 220
}
Image {
source: Qt.resolvedUrl("../assets/window3.png")
width: 64
height: 60
x: 5
y: 346
}
Image {
source: Qt.resolvedUrl("../assets/roost_higher.png")
width: 48
height: 13
x: 48
y: 126
}
Image {
source: Qt.resolvedUrl("../assets/roost_higher.png")
width: 48
height: 13
x: 48
y: 270
}
Image {
source: Qt.resolvedUrl("../assets/roost_higher.png")
width: 48
height: 13
x: 96
y: 270
}
Image {
source: Qt.resolvedUrl("../assets/roost_higher.png")
width: 48
height: 13
x: 144
y: 270
}
Image {
source: Qt.resolvedUrl("../assets/roost_higher.png")
width: 48
height: 13
x: 240
y: 366
}
Image {
id: corn
visible: false
source: Qt.resolvedUrl("../assets/corn.png")
width: 10.5
height: 15
x: 254
y: 348
}
Image {
id: corn1
visible: false
source: Qt.resolvedUrl("../assets/corn.png")
width: 10.5
height: 15
x: 265
y: 348
}
MouseArea {
id: visibleArea
visible: false
x: 244
y: 328
width: 50
height: 50
onClicked: {
hourlyBonus.giveBonus()
corn.visible = false
corn1.visible = false
visibleArea.visible = false
}
}
Component.onCompleted: {
if(hourlyBonus.isBonusTime()) {
corn.visible = true
corn1.visible = true
visibleArea.visible = true
}
}
Item {
id: hen
property bool moving: false
property alias mirror: spriteMovement.mirror
x: 96
y: 241
Image {
id: spriteFront
source: store.blackHen.purchased ? "../assets/chicken2-front.png" : "../assets/chicken4-front.png"
width: 30
height: 30
visible: !hen.moving
}
Image {
id: spriteMovement
source: store.blackHen.purchased ? "../assets/chicken2-side.png" : "../assets/chicken4-side.png"
width: 30
height: 30
visible: hen.moving
}
}
PropertyAnimation {
id: standStillCenter
target: hen
properties: "x"
to: hen.x
duration: 1000
running: true
onStarted: {
hen.moving = false
}
onStopped: moveLeft.start()
}
PropertyAnimation {
id: moveLeft
target: hen
properties: "x"
to: hen.x -48
duration: 1000
onStarted: {
hen.moving = true
hen.mirror = false
}
onStopped: standStillLeft.start()
}
PropertyAnimation {
id: standStillLeft
target: hen
properties: "x"
to: hen.x
duration: 1000
onStarted: {
hen.moving = false
}
onStopped: moveRight.start()
}
PropertyAnimation {
id: moveRight
target: hen
properties: "x"
to: hen.x +124
duration: 2700
onStarted: {
hen.moving = true
hen.mirror = true
}
onStopped: standStillRight.start()
}
PropertyAnimation {
id: standStillRight
target: hen
properties: "x"
to: hen.x
duration: 1000
onStarted: {
hen.moving = false
}
onStopped: moveToCenter.start()
}
PropertyAnimation {
id: moveToCenter
target: hen
properties: "x"
to: hen.x - 76
duration: 1500
onStarted: {
hen.moving = true
hen.mirror = false
}
onStopped: standStillCenter.start()
}
Item {
id: parachuteHen
x: 5
y: -90
Image {
id: parachute
source:"../assets/parachute.png"
width: 30
height: 30
x: sprite.x+sprite.width/2-width/2
y: sprite.y-20
rotation: 0
MouseArea {
anchors.fill: parent
onClicked: {
audioManager.play(audioManager.idPARACHUTE)
parachute.visible = false
parachuteFlight.stop()
parachuteFall.start()
}
}
}
Image {
id: sprite
source: store.blackHen.purchased ? "../assets/chicken2-front.png" : "../assets/chicken4-front.png"
width: 30
height: 30
}
onYChanged: {
if(y >= (mainScene.height+ 90) ) {
parachute.visible = true
parachuteFall.stop()
parachuteHen.y = -60
parachuteFlight.start()
}
}
}
PropertyAnimation {
id: parachuteFlight
target: parachuteHen
properties: "y"
to: mainScene.height + 90
duration: 15000
running: true
loops: Animation.Infinite
onStarted: parachuteHen.y = -60
}
PropertyAnimation {
id: parachuteFall
target: parachuteHen
properties: "y"
to: mainScene.height + 90
duration: 2000
running: false