Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Stack With Friends Demo

 import QtQuick 2.0
 import Felgo 3.0

 EntityBase {
   id: box
   entityType: "box"

   // the origin (the 0/0 position of the entity) of this entity is the center, thus we cannot use an anchors.fill: parent in Image and BoxCollider, otherwise it would use the top left corner as origin
   width: 30
   height: 30

   // the 0/0 of the entity should be the center of the collider and image
   // this is required when a width & height are set to the entity! in that case, the rotation should be applied around the center (which is top-left, not the width/2,height/2 Item.Center which is the default value)
   transformOrigin: Item.TopLeft

   Component.onCompleted: {
     boxImage.width = box.width
     boxImage.height = box.height

   Image {
     id: boxImage
     source: "../../assets/img/crate.png"

     // set the size of the image to the one of the collider and not vice versa, because the physics properties depend on the collider size
     x: boxCollider.x
     y: boxCollider.y
     width: 1
     height: 1
     Behavior on width {
       NumberAnimation {duration: 200}
     Behavior on height {
       NumberAnimation {duration: 200}

   BoxCollider {
     id: boxCollider

     // the size effects the physics settings (the bigger the heavier)
     // this is set automatically in any collider - the default size is the one of parent!
     //        width: parent.width
     //        height: parent.height
     // the collider should have its origin at the x/y of the entity (so the center is in the TopLeft)
     x: -width/2
     y: -height/2

     friction: 1.6
     restitution: 0 // restitution is bounciness - a wooden box doesn't bounce
     density: 0.2 // this makes the box more heavy

     categories: Box.Category1

     angularVelocity: utils.generateRandomValueBetween(-4, 4);

     EditableComponent {
       editableType: "Balancing"
       defaultGroup: "Box"
       properties: {
           "friction": {"min": 0, "max": 10, "stepsize": 0.1 },
           "restitution": {"min": 0, "max": 1,"stepsize": 0.1 },
           "density": {"min": 200, "max": 1000, "stepsize": 10 }