Squaby Demo
import QtQuick 2.0
import Felgo 4.0
Row {
anchors.bottom: parent.bottom
Item {
id: waveItem
width: 64
height: 64
MouseArea {
anchors.fill: parent
onClicked: {
var extraPoints = squabyCreator.createNextSquabyImmediately();
if(extraPoints>0 && !scene.endlessGameAllowed) {
pointsMessage.show(extraPoints)
}
}
}
SingleSquabySprite {
id: waveButton
source: Qt.resolvedUrl("../../../assets/img/menu_labels/labelWave.png")
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
}
Text {
id: waveTextItem
text: player.wave
color: "white"
font.pixelSize: 20
font.family: hudFont.name
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -15
}
Text {
text: squabyCreator.squabiesBuiltInCurrentWave + " | " + squabyCreator.amountSquabiesInCurrentWave
color: "white"
font.pixelSize: 10
font.family: hudFont.name
anchors.top: waveTextItem.bottom
anchors.topMargin: 1
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
id: pointsMessage
x: parent.width/2-text.pointsMessage/2
y: -pointsMessage.height
text: ""
color: "white"
opacity: 0
function show(points) {
pointsMessage.opacity = 1
pointsMessage.text = "+"+(points/100).toFixed(0)+" points"
player.instantBonus+= points/100
if(!hideMessage.running)
hideMessage.start()
}
Behavior on opacity {
NumberAnimation { duration: 350 }
}
Timer {
id: hideMessage
interval: 650
repeat: false
onTriggered: {
pointsMessage.opacity = 0
}
}
}
}
Item {
id: goldItem
width: 64
height: 64
SingleSquabySprite {
id: goldImage
source: Qt.resolvedUrl("../../../assets/img/menu_labels/menuIconGold.png")
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
}
Text {
id: goldTextItem
text: player.gold
color: "white"
font.pixelSize: 20
font.family: hudFont.name
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -12