Ground.qml Example File

demos/Platformer/qml/entities/Ground.qml
 import QtQuick 2.0
 import Felgo 3.0

 TiledEntityBase {
   id: ground
   entityType: "ground"

   size: 2 // must be >= 2, because we got a sprite for the start, one for the end and a repeatable center sprite

   Row {
     id: tileRow
     Tile {
       pos: "left"
       image: "../../assets/ground/left.png"
     }
     Repeater {
       model: size-2
       Tile {
         pos: "mid"
         image: "../../assets/ground/mid.png"
       }
     }
     Tile {
       pos: "right"
       image: "../../assets/ground/right.png"
     }
   }

   BoxCollider {
     anchors.fill: parent
     bodyType: Body.Static
     fixture.onBeginContact: {
       var otherEntity = other.getBody().target
       if(otherEntity.entityType === "player") player.contacts++
     }
     fixture.onEndContact: {
       var otherEntity = other.getBody().target
       if(otherEntity.entityType === "player") player.contacts--
     }
   }
 }

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
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support