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: "obstacleBlock"

   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

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

   BoxCollider {
     id: collider
     x: -width/2
     y: -height/2
     // this is set automatically from BoxCollider
     //width: parent.width
     //height: parent.height
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded