Squaby Demo
import QtQuick 2.0
import Felgo 4.0
Item {
id: rootSprite
rotation: -90
property alias squabySprite: squabySprite
signal animationFinished
GameSpriteSequence {
id: squabySprite
goalSprite: "walk"
anchors.centerIn: parent
spriteSheetSource: Qt.resolvedUrl("../../assets/img/spritesheets/squ" + squabySprite.variationTypeNumber + ".png")
onCurrentSpriteObjectChanged: {
if(currentSpriteObject === dieAnimationFinished) {
rootSprite.animationFinished()
}
}
property string variationType: parent.parent.variationType
property int variationTypeNumber: 1
onVariationTypeChanged: {
if(variationType === "squabyYellow")
variationTypeNumber = 1
else if(variationType === "squabyOrange")
variationTypeNumber = 2
else if(variationType === "squabyRed")
variationTypeNumber = 3
else if(variationType === "squabyGreen")
variationTypeNumber = 4
else if(variationType === "squabyBlue")
variationTypeNumber = 5
else if(variationType === "squabyGrey")
variationTypeNumber = 6
}
GameSprite {
name: "walk"
frameWidth: 32
frameHeight: 32
frameCount: 4
startFrameColumn: 1
frameRate: 20
}
GameSprite {
name: "whirl"
frameWidth: 32
frameHeight: 32
startFrameColumn: 14
frameCount: 2
frameRate: 20
}
GameSprite {
name: "jump"
frameWidth: 32
frameHeight: 32
startFrameColumn: 5
frameCount: 4
frameRate: 10
}
GameSprite {
name: "die"
frameWidth: 32
frameHeight: 32
frameCount: 3
startFrameColumn: 10
frameRate: 10
to: {"dieLastFrame":1}
}
GameSprite {
id: dieAnimationFinished
name: "dieLastFrame"
startFrameColumn: 12
frameWidth: 32
frameHeight: 32
duration: 10000
to: {"dieLastFrame":1}
}