Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Durdles - 2-Player Action Game

 import QtQuick 2.0
 import Felgo 4.0
 import "../common" as Common
 import ".."
 import "../levels"
 import "../entities"
 import "../entities/powerUps"

 Common.LevelBase {
   id: scene

   // place lakes in vertical center, one on the left and one on the right side
   Lake {
     id: lake1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - height / 2
       leftMargin: - width / 3
     }
     lakeBody.source: Qt.resolvedUrl("../../assets/img/Lake.png")
   }

   Lake {
     id: lake2
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - height / 2
       leftMargin: scene.width - width / 3 * 2.3
     }
     lakeBody.source: Qt.resolvedUrl("../../assets/img/Lake.png")
   }

   // snowmen in upper and lower half, horizontally centered
   Opponents {
     id: opponentSnowman1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 5 - height / 2
       leftMargin: scene.width / 2 - width / 2
     }
     opponentBody.source: Qt.resolvedUrl("../../assets/img/Snowman.gif")
   }

   Opponents {
     id: opponentSnowman2
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 5 * 4 - height / 2
       leftMargin: scene.width / 2 - width / 2
     }
     opponentBody.source: Qt.resolvedUrl("../../assets/img/Snowman.gif")
   }

   // obstacles in 4 corners
   Obstacle {
     id: obstacle1
     z: -1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 5 - height / 2
       leftMargin: scene.width / 4 - width / 2
     }
     obstacleBody.source: Qt.resolvedUrl("../../assets/img/Obstacle.png")
   }

   Obstacle {
     id: obstacle2
     z: -1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 5 - height / 2
       leftMargin: scene.width / 4 * 3 - width / 2
     }
     obstacleBody.source: Qt.resolvedUrl("../../assets/img/Obstacle.png")
   }

   Obstacle {
     id: obstacle3
     z: -1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 5 * 4 - height / 2
       leftMargin: scene.width / 4 - width / 2
     }
     obstacleBody.source: Qt.resolvedUrl("../../assets/img/Obstacle.png")
   }

   Obstacle {
     id: obstalce4
     z: -1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 5 * 4 - height / 2
       leftMargin: scene.width / 4 * 3 - width / 2
     }
     obstacleBody.source: Qt.resolvedUrl("../../assets/img/Obstacle.png")
   }

   // trees: plant a line of trees along the vertical center, between the lakes
   Tree {
     entityId: "tree1"
     id: tree1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - height / 2
       leftMargin: scene.width / 2 - width / 2
     }
     treeBody.source: Qt.resolvedUrl("../../assets/img/Tree.png")
   }

   Tree {
     entityId: "tree2"
     id: tree2
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - height / 2
       leftMargin: scene.width / 2 + 35
     }
     treeBody.source: Qt.resolvedUrl("../../assets/img/Tree.png")
   }

   Tree {
     entityId: "tree3"
     id: tree3
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - height / 2
       leftMargin: scene.width / 2 + 70
     }
     treeBody.source: Qt.resolvedUrl("../../assets/img/Tree.png")
   }

   Tree {
     entityId: "tree4"
     id: tree4
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - height / 2
       leftMargin: scene.width / 2 - 35
     }
     treeBody.source: Qt.resolvedUrl("../../assets/img/Tree.png")
   }

   Tree {
     entityId: "tree5"
     id: tree5
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - height / 2
       leftMargin: scene.width / 2 - 70
     }
     treeBody.source: Qt.resolvedUrl("../../assets/img/Tree.png")
   }

   // PowerUpSpawn in upper and lower half, horizontally centered
   PowerUpSpawn {
     entityId: "spawn1"
     id: spawn1
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 - 75
       leftMargin: scene.width / 2 - width / 2
     }
     spawnBody.source: Qt.resolvedUrl("../../assets/img/PUSpawn.png")
   }

   PowerUpSpawn {
     entityId: "spawn2"
     id: spawn2
     anchors {
       top: scene.top
       left: scene.left
       topMargin: scene.height / 2 + 75
       leftMargin: scene.width / 2 - width / 2
     }
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded