Squaby Demo
import QtQuick 2.0
import Felgo 4.0
TowerBaseSprite {
id: turbineSprite
spriteSheetSource: Qt.resolvedUrl("../../assets/img/spritesheets/turbine/1-Turbine_base.png")
property alias running: explodeSprite.running
property alias sprite: explodeSprite
scale: 0.875
Item {
rotation: turbineSprite.parent.rotation
GameSpriteSequence {
id: explodeSprite
anchors.centerIn: parent
defaultSource: Qt.resolvedUrl("../../assets/img/spritesheets/turbine/turbine.png")
GameSprite {
id: idle
name: "idle"
startFrameColumn: 1
startFrameRow: frameElement
frameCount: 1
frameWidth: 32
frameHeight: 32
frameDuration: 100000
}
GameSprite {
id: explodeAnimation
name: "explode"
startFrameColumn: 2
startFrameRow: frameElement
frameCount: 4
frameWidth: 32
frameHeight: 32
frameRate: 10
to: { "explodeLastFrame": 1 }
}
GameSprite {
id: explodeLastFrameAnimation
name: "explodeLastFrame"
startFrameColumn: explodeAnimation.startFrameColumn+explodeAnimation.frameCount - 1
startFrameRow: frameElement
frameCount: 1
frameWidth: 32
frameHeight: 32
frameRate: 100000
}
}
GameSpriteSequence {
id: whirlSprite
defaultSource: Qt.resolvedUrl("../../assets/img/spritesheets/turbine/whirl.png")
visible: false
running: false
x: -whirlSprite.width/2
y: -16
GameSprite {
id: whirlAnimation
name: "whirl"
frameCount: 3
frameRate: 60
frameWidth: 64
frameHeight: 64
}
}
}
function explode() {
explodeSprite.jumpTo("explode");
}
function repair() {
explodeSprite.jumpTo("idle");
}
states: [
State {
name: "whirl"
PropertyChanges { target: whirlSprite; visible: true}
PropertyChanges { target: whirlSprite; running: true}