Bear cannot move in sprite, Help !!
-
I would like to learn how to use sprite.
I found the link below: but i can't find starfish_1.png
https://qt.gitorious.org/qt/qtdeclarative/source/75a0d33d250a97d5ee0314f5b7aad876d9ee2fa8:examples/particles/imageparticle/sprites.qmlbear_tiles.png file can be downloaded at the link below
http://m.blog.csdn.net/blog/u011348999/35786691Below is my code
@
import QtQuick 2.0
Rectangle {color:"blue"
width: 800
height:800
id: rootSpriteSequence{
sprites: Sprite{
name:"bear"
source: "file:///home/common/Desktop/bear.png"
frameCount:13
frameDuration: 120
}
width:250
height:250
x:20
anchors.bottom:parent.bottom
anchors.bottomMargin:20
X=4
}
MouseArea {
id:mouse
anchors.fill:parent
}
}
@
-----Second attempt no:error, but i could not see anything--------------
@import QtQuick 2.2
import QtQuick.Window 2.1Window {
visible: true
width: 3600
height: 3600Rectangle{ anchors.fill: parent color:"white" } AnimatedSprite{ id: sprite width:170 height:170 anchors.centerIn: parent source:"file:/home/common/Desktop/beach.png" frameCount:13 frameDuration: 120 loops: 3 MouseArea { anchors.fill:parent acceptedButtons:Qt.LeftButton | Qt.RightButton onClicked: { if(!sprite.running) sprite.start(); if(!sprite.paused) sprite.paused(); if(mouse.button==Qt.LeftButton){ sprite.advance(1); } else { sprite.advance(-1); } } } }
}
========================
@