Durdles - 2-Player Action Game
import QtQuick 2.0
import Felgo 4.0
import ".."
EntityBase {
entityType: "tank"
entityId: "tank"
variationType: "tankRed"
id: tank
x: originX
y: originY
property alias controller: twoAxisController
property alias tankBody: tankBody
property alias tankHead: tankHead
property alias tankCannon: tankCannon
property alias circleCollider: circleCollider
property alias shield: shield
property alias fire: fire
property alias plingSound: plingSound
property int life: 3
property double originX
property double originY
TwoAxisController {
id: twoAxisController
}
AnimatedImage {
id: tankBody
width: 20
height: 20
anchors.centerIn: parent
playing: false
}
Rectangle {
id: tankCannon
x: tankBody.x + tankBody.width / 2
y: tankBody.y + tankBody.height / 2 - 2
width: 4
height: 4
transformOrigin: Item.Left
color: "transparent"
AnimatedImage {
z: 0
id: tankHead
width: 18
height: 18
anchors.centerIn: tankCannon
playing: false
}
}
CircleCollider {
enabled: !GameInfo.gamePaused
id: circleCollider
radius: 10
x: -radius
y: -radius
density: 0
friction: 0.4
restitution: 0.4
linearDamping: 100
bullet: true
linearVelocity: Qt.point(twoAxisController.xAxis * 100, twoAxisController.yAxis * (-100))
}
Image {
opacity: 0
id: shield
width: 35
height: 35
anchors.centerIn: parent
source: Qt.resolvedUrl("../../assets/img/Shield.png")
}
AnimatedImage {
z: -1
rotation: tankBody.rotation + 180
opacity: 0
id: fire
width: 22
height: 34
anchors.centerIn: parent
playing: true
source: Qt.resolvedUrl("../../assets/img/Rocket.gif")
}
GameSoundEffect {
volume: 0.3
id: plingSound