BorderRegion.qml Example File

 import QtQuick 2.0

 import Felgo 3.0

 // the 2 BorderRegion entities (one on top and one on bottom of the screen) are not visible because they are offscreen
 // if the topRegion collides with a roost, a coin or a window, they get removed and used for pooling
 // if the topRegion collides with the player, that means the game is lost as the player got out of the scene on the top
 // the bottomRegion is only for detecting collision with the player, so if he falls through and cant stand on a roost, the game is lost
 EntityBase {
   id: entity
   entityType: "borderRegion"
   // either is topRegion or BorderRegion - topRegion removes the collided block or coin entity at collision, whereas BorderRegion doesn't!
   variationType: "topRegion"

   // will be handled in Level when the region collides with the player, which means the game is lost
   signal playerCollision

   // these only exist once and should not be pooled
   preventFromRemovalFromEntityManager: true

   BoxCollider {
     id: boxCollider
     // the body must be of type dynamic, otherwise no collisions between the other static bodies (roosts & coins) would be possible!
     bodyType: Body.Dynamic
     // this is required, because the position should not be modified from the physics system, but from the QML positioning!
     // if only sensor would be set to true it would not be enough, because then the body would fall down based on gravity!
     collisionTestingOnlyMode: true

     fixture.onBeginContact: {

       var fixture = other;
       var body = other.getBody();
       var collidedEntity =;
       var collidedEntityType = collidedEntity.entityType;

       console.debug("BorderRegion: collided with entity type:", collidedEntityType);

       if(collidedEntityType === "player")
         // game is lost, player reached top or bottom of scene
       else {
         // don't remove the collided entity if this is the bottomRegion, because entities are created outside the scene and thus they would constantly collide with the bottomRegion
         if(variationType === "bottomRegion")

         // do not remove this entity, as it is the one where the player should stand when it gets deleted!
         if(collidedEntity.entityId === "playerInitialBlock")

         // collision with another entity, so either a block gotten out of range, or a coin, which should be removed now (it uses pooling though!)

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support