Hi again,
Now Im trying to figure out how I would set an event to listen for when the animated sprite (id:walk) collides with the other sprite of a cannon (id:cannon). On contact I would like to player to be launched vertically. Would this be done with FixtureBeginOnContact?
This is my code…
import QtQuick 2.7
import QtQuick.Window 2.2
Item {
width:Screen.width
height:Screen.height-10
focus: true
Keys.onPressed: {
if (event.key===Qt.Key_Right){
event.accepted = true;
walk.x=(walk.x) +7
}
if (event.key===Qt.Key_Left){
event.accepted = true;
walk.x=(walk.x) -7
}
}
Flickable{
width:Screen.width
height:Screen.height
contentHeight: Screen.height *4
contentWidth: Screen.width
interactive: true
boundsBehavior: Flickable.StopAtBounds
Image{
id: box
anchors.fill: parent
source: "artwork/rect.png"
sourceSize.width: Screen.width
sourceSize.height: Screen.height*4
}
AnimatedSprite {
id: walk
width: 100
height: 200
anchors.centerIn: horizontalCenter
source: "artwork/WalkingManSpriteSheet.png"
frameCount: 8
frameRate: 6
frameWidth: 40
frameHeight:60
loops: 100
x: 200
y: 3625
}
Image{
id:twitter
source: "artwork/twitter.png"
x:500
y:horizontalCenter
}
AnimatedSprite {
id: cannon
width: 300
height: 425
anchors.centerIn: hoizontalCenter
source: "artwork/cannon.png"
frameCount: 12
frameRate: 8
frameWidth: 128
frameHeight:155
loops: 100
x:1250
y:3550
}
}
}