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

Stack With Friends Demo

 import QtQuick 2.0
 import Felgo 3.0
  // for accessing the Body.Static type

 EntityBaseDraggable {
   id: obstacle
   entityType: "obstacleTriangle"

   width: 32
   height: 32

   levelWidth: gameScene.width

   colliderComponent: collider

   selectionMouseArea.anchors.fill: sprite
   inLevelEditingMode: gameScene.state === "levelEditing"
   dragOffset: Qt.point(0,0)

   // the gridSize can also be smaller than the width, then the levels do not look as blocky and it is not a real grid
   gridSize: 16
   colliderSize: width

   // this item will blink when the entity is selected
   opacityChangeItemWhileSelected: sprite

   onEntityClicked: gameScene.entitySelected(obstacle)

   // if the obstacle was pressed and held, remove it
   onEntityPressAndHold: removeEntity()

   //dragOffset: Qt.point(0,0)
   delayDragOffset: true

   Image {
     id: sprite
     x: -width/2
     y: -height/2
     width: parent.width
     height: parent.height
     source: "../../assets/img/block2.png"
   }

   PolygonCollider {
     id: collider
     bodyType: Body.Static // the body shouldnt move
     // this makes the triangle shape in physics
     vertices: [
       Qt.point(-15, -15),
       Qt.point(-15, 15),
       Qt.point(15, 15)
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded