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

Durdles - 2-Player Action Game

 import QtQuick 2.0
 import Felgo 4.0
 import "../levels"
 import ".."

 // energy bar displays the energy of the players
 Item {
   id: energyBar
   width: 80
   height: 16
   opacity: GameInfo.opacity

   // make the bars accessible from outside
   property alias energyBarOuterBody: energyBarOuterBody
   property alias energyBarInnerBody: energyBarInnerBody
   property int energy     // set outside
   property color barColor // set outside
   property int gap: GameInfo.border

   // the outer border surrounds the health bar
   Rectangle {
     border.width: gap
     border.color: barColor
     id: energyBarOuterBody
     anchors.fill: parent
     color: Qt.lighter(barColor, GameInfo.lighterColor)
     radius: GameInfo.radius

     // the inner rectangle grows and shrinks depending on the player's health
     Rectangle {
       radius: parent.radius - 3
       id: energyBarInnerBody
       width: (parent.width / 100 * energy) - (gap * 3)
       height: parent.height - (gap * 3)
       anchors.verticalCenter: parent.verticalCenter
       anchors.left: parent.left
       anchors.leftMargin: gap * 1.5
       gradient: Gradient {
         GradientStop { position: 0.0; color: Qt.lighter(barColor, 1.2) }
         GradientStop { position: 1.0; color: barColor }
       }
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded