Durdles - 2-Player Action Game
import QtQuick 2.0
import Felgo 4.0
import "../levels"
import ".."
EntityBase {
z: -2
id: lake
entityId: "lake"
entityType: "lake"
width: 250
height: 200
property alias lakeBody: lakeBody
property alias boxCollider: boxCollider
Image {
id: lakeBody
width: parent.width
height: parent.height
anchors.centerIn: parent
}
PolygonCollider {
id: boxCollider
anchors.centerIn: parent
collisionTestingOnlyMode: true
vertices: [
Qt.point(lakeBody.x+lakeBody.width-50, lakeBody.y+45),
Qt.point(lakeBody.x+110,lakeBody.y+15),
Qt.point(lakeBody.x+65, lakeBody.y+lakeBody.height-65),
Qt.point(lakeBody.x+lakeBody.width-75, lakeBody.y+lakeBody.height-45)
]
fixture.onBeginContact: (other, contactNormal) => {
var collidedEntity = other.getBody().target;
if (collidedEntity.isOfType("tank")){
collidedEntity.parent.onLake = true
}
}
fixture.onEndContact: other => {
var collidedEntity = other.getBody().target;
if (collidedEntity.isOfType("tank")){
collidedEntity.parent.onLake = false
gameScene.offLake(collidedEntity.parent.variationType)
}