Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > bdbbdfc3f538bf93bb0eb988a7a43005 > files > 477

qtdoc5-5.12.6-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- maroon.qdoc -->
  <title>Qt Quick Demo - Maroon in Trouble | Qt 5.12</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.12</a></td><td >Qt Quick Demo - Maroon in Trouble</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.12.6 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#running-the-example">Running the Example</a></li>
<li class="level1"><a href="#adding-screens">Adding Screens</a></li>
<li class="level1"><a href="#constructing-the-background">Constructing the Background</a></li>
<li class="level1"><a href="#animating-background-objects">Animating Background Objects</a></li>
<li class="level1"><a href="#emitting-particles">Emitting Particles</a></li>
<li class="level1"><a href="#using-timers">Using Timers</a></li>
<li class="level1"><a href="#constructing-the-game-board">Constructing the Game Board</a></li>
<li class="level1"><a href="#animating-objects-on-the-game-board">Animating Objects on the Game Board</a></li>
<li class="level2"><a href="#spawning-fish">Spawning Fish</a></li>
<li class="level2"><a href="#bursting-bubbles">Bursting Bubbles</a></li>
<li class="level1"><a href="#adding-dialogs">Adding Dialogs</a></li>
<li class="level1"><a href="#keeping-track-of-game-statistics">Keeping Track of Game Statistics</a></li>
<li class="level1"><a href="#managing-game-states">Managing Game States</a></li>
<li class="level1"><a href="#playing-sound-effects">Playing Sound Effects</a></li>
<li class="level1"><a href="#adding-keyboard-shortcuts">Adding Keyboard Shortcuts</a></li>
<li class="level1"><a href="#packaging-resources-for-deployment">Packaging Resources for Deployment</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Qt Quick Demo - Maroon in Trouble</h1>
<span class="subtitle"></span>
<!-- $$$demos/maroon-brief -->
<p>A Qt Quick game for touch devices that uses SpriteSequence, ParticleSystem, Emitter, and Wander types to animate objects and the SoundEffect type to play sound effects.</p>
<!-- @@@demos/maroon -->
<!-- $$$demos/maroon-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/qtquick-demo-maroon-med-2.png" alt="" /></p><p><i>Maroon in Trouble</i> demonstrates QML features that are useful when developing games:</p>
<ul>
<li>Using custom QML types to create different screens for different stages of the game.</li>
<li>Using the Item and Image types to construct a game background.</li>
<li>Using the SequentialAnimation, NumberAnimation, ParticleSystem, Emitter, and Wander types to animate background objects.</li>
<li>Using the <a href="qtquick-debugging.html#timer">Timer</a> and Repeater types to display a countdown sequence before starting the game.</li>
<li>Using a custom QML type with custom properties to construct a game board.</li>
<li>Using the SpriteSequence and Sprite types to add animated objects to the game board.</li>
<li>Using a custom QML type that uses the Image type with some custom properties to add a menu where the players can buy objects.</li>
<li>Using custom properties with private functions to keep track of game statistics and a custom QML type to display them to the players.</li>
<li>Using the State type with JavaScript functions to manage game states.</li>
<li>Using the SoundEffect type to play individual sound effects depending on the object type and the action applied to the object.</li>
<li>Using signal handlers to specify keyboard shortcuts for some game actions.</li>
<li>Using resource files to package game resources for deployment and delivery.</li>
</ul>
<a name="running-the-example"></a>
<h2 id="running-the-example">Running the Example</h2>
<p>To run the example from <a href="http://doc.qt.io/qtcreator/index.html">Qt Creator</a>, open the <b>Welcome</b> mode and select the example from <b>Examples</b>. For more information, visit <a href="http://doc.qt.io/qtcreator/creator-build-example-application.html">Building and Running an Example</a>.</p>
<a name="adding-screens"></a>
<h2 id="adding-screens">Adding Screens</h2>
<p>In the Maroon in Trouble app, we use the following custom types that are each defined in a separate .qml file to create the game screens:</p>
<ul>
<li>NewGameScreen.qml</li>
<li>GameCanvas.qml</li>
<li>GameOverScreen.qml</li>
</ul>
<p>To use the custom types, we add an import statement to the main QML file, maroon.qml that imports the folder called <code>content</code> where the types are located:</p>
<pre class="cpp">

  import "content"

</pre>
<p>We use the screen types at different stages of the game. The NewGameScreen type is used to create the screen that appears when the players start the app. In NewGameScreen.qml, we use an Image type to create a New Game button that the players can press to start a new game.</p>
<p class="centerAlign"><img src="images/qtquick-demo-maroon-med-1.png" alt="" /></p><p>Tapping the button initiates a countdown timer that triggers the creation of the game canvas by using the GameCanvas type. Another <a href="qtquick-debugging.html#timer">Timer</a> type spawns mobs of fish inside bubbles that the players must free before they reach the surface. The players can tap on the screen to open a menu where they can buy different types of weapons (melee, ranged, and bombs) to burst the bubbles.</p>
<p class="centerAlign"><img src="images/qtquick-demo-maroon-med-2.png" alt="" /></p><p>When the game finishes, a screen created by using the GameOverScreen type appears. On this screen, the players can see their score and start a new game.</p>
<p class="centerAlign"><img src="images/qtquick-demo-maroon-med-3.jpg" alt="" /></p><p>The screens are all created on the same background and use some of the same images and animations.</p>
<a name="constructing-the-background"></a>
<h2 id="constructing-the-background">Constructing the Background</h2>
<p>In the maroon.qml file, we use an Item type with the id <code>root</code> and a fixed width and height to create a main window for the game:</p>
<pre class="cpp">

  Item {
      id: root
      width: 320
      height: 480
      property var gameState
      property bool passedSplash: false

</pre>
<p>We declare two custom properties for the root item, <code>gameState</code> and <code>passedSplash</code> that we will use later to manage game states.</p>
<p>We use an Image item to display the game background image:</p>
<pre class="cpp">

      Image {
          source:"content/gfx/background.png"
          anchors.bottom: view.bottom

</pre>
<p>We want to be able to load the background image only once at app startup and still use different scenes for the game screens. Therefore, background.png is three times the length of the root item and displays a scene that stretches from the bottom of sea to the sky above the horizon.</p>
<p>We use the <code>anchors.bottom</code> property to anchor the background image to the bottom of the Column layout that we use to position the screens:</p>
<pre class="cpp">

      Column {
          id: view
          y: -(height - 480)
          width: 320

          GameOverScreen { gameCanvas: canvas }

</pre>
<p>We set a negative value for the <code>y</code> property to set the first scene at the bottom of the sea. We calculate the position by subtracting the height of a screen from the <code>height</code> property.</p>
<p>Within the column layout, we use an Item type to add objects to the background. Within the item, we use Row layout objects to position Image objects that display waves on the game canvas and the game over screen:</p>
<pre class="cpp">

          Item {
              id: canvasArea
              width: 320
              height: 480

              Row {
                  height: childrenRect.height
                  Image {
                      id: wave
                      y: 30
                      source:"content/gfx/wave.png"
                  }
                  Image {
                      y: 30
                      source:"content/gfx/wave.png"
                  }
      ...
              Row {
                  opacity: 0.5
                  Image {
                      id: wave2
                      y: 25
                      source: "content/gfx/wave.png"
                  }
                  Image {
                      y: 25
                      source: "content/gfx/wave.png"
                  }

</pre>
<p>The second row of waves is positioned on the y axis with a slight offset to the first row. We also use the <code>opacity</code> property to make the waves appear lighter in color than the first two waves, which gives the background some depth.</p>
<p>We use Image objects to also display sunlight on the new game screen and on the game canvas:</p>
<pre class="cpp">

              Image {
                  source: "content/gfx/sunlight.png"
                  opacity: 0.02
                  y: 0
                  anchors.horizontalCenter: parent.horizontalCenter
      ...
              Image {
                  source: "content/gfx/sunlight.png"
                  opacity: 0.04
                  y: 20
                  anchors.horizontalCenter: parent.horizontalCenter

</pre>
<p>We set the <code>opacity</code> property of the images to <code>0.02</code> and <code>0.04</code> to give some depth to the rays of sunshine. We use the <code>y</code> property to position the images at fixed locations on the y axis and the <code>anchors.horizontalCenter</code> property to center them horizontally in relation to their parent.</p>
<p>We use an Image type to display an image that adds a deepening shadow to the background:</p>
<pre class="cpp">

              Image {
                  source: "content/gfx/grid.png"
                  opacity: 0.5
              }

</pre>
<p>We set the <code>opacity</code> property of the image to <code>0.5</code> to make the background visible behind the shadow.</p>
<p>To make the background more interesting, we animate some of the objects we added to it.</p>
<a name="animating-background-objects"></a>
<h2 id="animating-background-objects">Animating Background Objects</h2>
<p>We use NumberAnimation to move the waves horizontally across the screen in opposite directions and SequentialAnimation with NumberAnimation to move them up and down.</p>
<p>We apply the number animation to the <code>x</code> property of <code>wave</code> as a property value source to animate the x value from its current value to the <code>-(wave.width)</code>, over 16 seconds. We set the <code>loops</code> property to <code>Animation.Infinite</code> to repeat the animation indefinitely:</p>
<pre class="cpp">

                  NumberAnimation on x { from: 0; to: -(wave.width); duration: 16000; loops: Animation.Infinite }

</pre>
<p>We apply the sequential animation to the <code>y</code> property of the image as a property value source to animate the y value. We use one number animation to animate the image from the y position of two below the value of y to two above it, over 1600 milliseconds. We use another number animation to subsequently animate the image in the opposite direction, again over 1600 milliseconds. The animation is repeated indefinitely:</p>
<pre class="cpp">

                  SequentialAnimation on y {
                      loops: Animation.Infinite
                      NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad }
                      NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad }
                  }

</pre>
<p>We use the easing curve of the type <code>Easing.InOutQuad</code> for a quintic (t^5) function to accelerate the motion until halfway and then decelerate it.</p>
<p>We use sequential animation and number animation to animate <code>wave2</code> similarly to <code>wave</code>, but in the opposite direction:</p>
<pre class="cpp">

                  SequentialAnimation on y {
                      loops: Animation.Infinite
                      NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad }
                      NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad }
                  }

</pre>
<p>We use sequential animation to rotate the rays of sunlight in degrees clockwise around an origin point that we set to <code>Item.Top</code> in the <code>transformOrigin</code> property. The animation is repeated indefinitely:</p>
<pre class="cpp">

                  transformOrigin: Item.Top
                  SequentialAnimation on rotation {
                      loops: Animation.Infinite
                      NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine }
                      NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine }
                  }

</pre>
<p>We use one number animation to rotate the image from <code>-10</code> degrees to <code>10</code> degrees over 8 seconds and another to subsequently rotate it from <code>10</code> degrees to <code>-10</code> degrees over the same duration.</p>
<p>We use the easing curve of the type <code>Easing.InOutSine</code> for a sinusoidal (sin(t)) function to accelerate the motion until halfway and then decelerate it.</p>
<p>We use sequential animation and number animation to animate another sunlight.png image similarly, but in the opposite direction:</p>
<pre class="cpp">

                  transformOrigin: Item.Top
                  SequentialAnimation on rotation {
                      loops: Animation.Infinite
                      NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine }
                      NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine }
                  }

</pre>
<p>For examples of using SequentialAnimation and NumberAnimation on the <code>x</code> and <code>y</code> properties and the <code>width</code> and <code>height</code> properties, see NewGameScreen.qml.</p>
<a name="emitting-particles"></a>
<h2 id="emitting-particles">Emitting Particles</h2>
<p>In addition to animation, we use particles to generate motion on the game screens. We use the ParticleSystem QML type in maroon.qml to make bubbles appear at the bottom of the new game screen and game canvas and slowly float towards the top on varying trajectories.</p>
<p>To use the ParticleSystem type, we must import Qt Quick Particles QML Types:</p>
<pre class="cpp">

  import QtQuick.Particles 2.0

</pre>
<p>To have the particles appear on the game background, we place the ParticleSystem type within the Image type that displays the game background:</p>
<pre class="cpp">

      Image {
          source:"content/gfx/background.png"
          anchors.bottom: view.bottom

          ParticleSystem {
              id: particles
              anchors.fill: parent

</pre>
<p>In the ParticleSystem, we use an Emitter type to emit particles from the location of the emitter at the rate of two per second with the life span of 15 seconds:</p>
<pre class="cpp">

              Emitter {
                  width: parent.width
                  height: 150
                  anchors.bottom: parent.bottom
                  anchors.bottomMargin: 3
                  startTime: 15000

                  emitRate: 2
                  lifeSpan: 15000

                  acceleration: PointDirection{ y: -6; xVariation: 2; yVariation: 2 }

                  size: 24
                  sizeVariation: 16
              }

</pre>
<p>The <code>acceleration</code> property uses the PointDirection type to specify random variation of the x and y coordinates, so that the bubbles appear inside a rectangular area around the emitter that is anchored to the bottom of the image.</p>
<p>The <code>size</code> property sets the base size of the particles at the beginning of their life to 24 pixels and the <code>sizeVariation</code> property randomly increases or decreases the particle size by up to 16 pixels, so that we get bubbles in different sizes.</p>
<p>As emitters have no visualization, we use the ImageParticle type to render the catch.png image at the particle location:</p>
<pre class="cpp">

              ImageParticle {
                  id: bubble
                  anchors.fill: parent
                  source: "content/gfx/catch.png"
                  opacity: 0.25
              }

</pre>
<p>A Wander type applies a random trajectory to the particles, so that the bubbles follow random routes from the bottom to the top.</p>
<pre class="cpp">

              Wander {
                  xVariance: 25;
                  pace: 25;
              }

</pre>
<p>For another example of using the ParticleSystem type, see the GameOverScreen.qml file, where an ImageParticle type is used to make clouds move across the sky.</p>
<a name="using-timers"></a>
<h2 id="using-timers">Using Timers</h2>
<p class="centerAlign"><img src="images/qtquick-demo-maroon-med-4.jpg" alt="" /></p><p>In maroon.qml, we use the <a href="qtquick-debugging.html#timer">Timer</a> type with a Repeater type to display a countdown sequence before using another timer to start a new game. Both timers are started simultaneously in the <code>&quot;gameOn&quot;</code> state, that is when the players tap the New Game button and <code>passedSplash</code> is <code>true</code>. This is explained in more detail in <a href="qtdoc-demos-maroon-example.html#managing-game-states">Managing Game States</a>.</p>
<p>We use the <code>countdownTimer</code> to display the countdown sequence:</p>
<pre class="cpp">

              Timer {
                  id: countdownTimer
                  interval: 1000
                  running: root.countdown < 5
                  repeat: true
                  onTriggered: root.countdown++
              }

</pre>
<p>The <code>onTriggered</code> signal handler is called when the timer is triggered to increment the value of the <code>countdown</code> custom property.</p>
<p>We set the <code>repeat</code> property to <code>true</code> to specify that the timer is triggered at the interval of 1 second as long as the value of <code>countdown</code> is less than 5.</p>
<p>The <code>countdown</code> property is defined in the root item with an initial value of <code>10</code>, so that <code>countdownTimer</code> is not running by default:</p>
<pre class="cpp">

      property int countdown: 10

</pre>
<p>Each time the timer is triggered, an image from the countdown sequence is displayed. We use a Repeater type to instantiate the Image delegate in the context of the repeater's parent, <code>canvasArea</code> item, seeded with data from the <code>model</code>:</p>
<pre class="cpp">

              Repeater {
                  model: ["content/gfx/text-blank.png", "content/gfx/text-3.png", "content/gfx/text-2.png", "content/gfx/text-1.png", "content/gfx/text-go.png"]
                  delegate: Image {
                      visible: root.countdown <= index
                      opacity: root.countdown == index ? 0.5 : 0.1
                      scale: root.countdown >= index ? 1.0 : 0.0
                      source: modelData
                      Behavior on opacity { NumberAnimation {} }
                      Behavior on scale { NumberAnimation {} }
                  }
              }

</pre>
<p>We scale the images from <code>0.0</code> to <code>1.0</code> and use the <code>visible</code> property to hide the images for the previous steps as the countdown progresses. We also raise the opacity of the image that matches the current countdown step, keeping the others nearly transparent.</p>
<p>By animating the changes in the <code>opacity</code> and <code>scale</code> properties using a Behavior type, we achieve a countdown sequence where numbers zoom in towards the players.</p>
<a name="constructing-the-game-board"></a>
<h2 id="constructing-the-game-board">Constructing the Game Board</h2>
<p>To construct the game board, we use the GameCanvas custom type that is defined in GameCanvas.qml.</p>
<p>In maroon.qml, we use the GameCanvas type to display the game canvas at the position of 32 on the x axis and 20 pixels from the bottom of its parent item, <code>canvasArea</code>:</p>
<pre class="cpp">

              GameCanvas {
                  id: canvas
                  anchors.bottom: parent.bottom
                  anchors.bottomMargin: 20
                  x: 32
                  focus: true
              }

</pre>
<p>We set the <code>focus</code> property to <code>true</code> to give <code>canvas</code> active focus on startup.</p>
<p>In GameCanvas.qml, we use an Item type and define custom properties for it to create a grid of equally sized squares divided to 4 columns on 6 rows:</p>
<pre class="cpp">

  Item {
      id: grid

      property int squareSize: 64
      property int rows: 6
      property int cols: 4
      property Item canvas: grid

</pre>
<p>We use the custom properties to set the <code>width</code> and <code>height</code> of the <code>grid</code> item as the amount of columns and rows multiplied by square size:</p>
<pre class="cpp">

      width: cols * squareSize
      height: rows * squareSize

</pre>
<p>We use an Image type with a MouseArea type to display a help button that the players can tap to view an image that contains instructions for playing the game:</p>
<pre class="cpp">

      Image {
          id: helpButton
          z: 1010
          source: "gfx/button-help.png"
          function goAway() {
              helpMA.enabled = false;
              helpButton.opacity = 0;
          }
          function comeBack() {
              helpMA.enabled = true;
              helpButton.opacity = 1;
          }
          Behavior on opacity { NumberAnimation {} }
          MouseArea {
              id: helpMA
              anchors.fill: parent
              onClicked: {helpImage.visible = true; helpButton.visible = false;}
          }

          anchors.horizontalCenter: parent.horizontalCenter
          anchors.bottom: parent.bottom
          anchors.bottomMargin: 0
      }

</pre>
<p>We declare the <code>goAway()</code> private function to disable the mouse area and make the image fully transparent and a <code>comeBack()</code> function to enable the mouse area and make the button fully opaque. We use a Behavior type on the <code>opacity</code> property to apply the default number animation when the value of <code>opacity</code> changes.</p>
<p>When the players tap the help button, the <code>onClicked</code> signal handler is called to hide the help button by setting the <code>helpButton.visible</code> property to <code>false</code> and to show the help image by setting the <code>helpImage.visible</code> property to <code>false</code>.</p>
<p class="centerAlign"><img src="images/qtquick-demo-maroon-med-6.jpg" alt="" /></p><p>We use anchoring to position the help button at the bottom center of the game canvas.</p>
<p>We use another Image type to display the help image:</p>
<pre class="cpp">

      Image {
          id: helpImage
          z: 1010
          source: "gfx/help.png"
          anchors.fill: parent
          visible: false
          MouseArea {
              anchors.fill: parent
              onClicked: helpImage.visible = false;
          }
      }

</pre>
<p>To hide the help image when the players tap it, the <code>onClicked</code> signal handler within the MouseArea type is called to set the <code>helpImage.visible</code> property to <code>true</code>.</p>
<p>To ensure that the images are placed on top when they are visible, we set a high value for their <code>z</code> property.</p>
<p>The following sections describe how to use timers to add animated objects to the game board and how to create a menu dialog from which the players can add more objects to it.</p>
<a name="animating-objects-on-the-game-board"></a>
<h2 id="animating-objects-on-the-game-board">Animating Objects on the Game Board</h2>
<p>We use sprite animation to animate objects on the game board. The Qt Quick sprite engine is a stochastic state machine combined with the ability to chop up images containing multiple frames of an animation.</p>
<a name="spawning-fish"></a>
<h3 id="spawning-fish">Spawning Fish</h3>
<p>We use a <a href="qtquick-debugging.html#timer">Timer</a> element with the <code>tick()</code> function in GameCanvas.qml to spawn mobs of fish in waves at an increasing rate, starting at 16 milliseconds:</p>
<pre class="cpp">

      Timer {
          interval: 16
          running: true
          repeat: true
          onTriggered: Logic.tick()
      }

</pre>
<p>We use the MobBase custom type that is defined in MobBase.qml to animate mobs of fish that swim inside bubbles. We use an Item type with custom properties and private functions to create the fish and the bubbles and to define the actions that can be applied to them:</p>
<pre class="cpp">

  Item  {
      id: container
      property string name: "Fish"
      property int col: 0
      property real hp: 3
      property real damage: 1
      property real speed: 0.25
      property int rof: 30 //In ticks
      property int fireCounter: 0
      property bool dying: false
      width: parent ? parent.squareSize : 0
      height: parent ? parent.squareSize : 0
      x: col * width
      z: 1001
      function fire() { }
      ...

</pre>
<p>We use a SpriteSequence type to animate the fish:</p>
<pre class="cpp">

      SpriteSequence {
          id: fishSprite
          width: 64
          height: 64
          interpolate: false
          goalSprite: ""

</pre>
<p>The SpriteSequence type renders and controls a list of animations defined by Sprite types:</p>
<pre class="cpp">

          Sprite {
              name: "left"
              source: "../gfx/mob-idle.png"
              frameWidth: 64
              frameHeight: 64
              frameCount: 1
              frameDuration: 800
              frameDurationVariation: 400
              to: { "front" : 1 }
          }

          Sprite {
              name: "front"
              source: "../gfx/mob-idle.png"
              frameCount: 1
              frameX: 64
              frameWidth: 64
              frameHeight: 64
              frameDuration: 800
              frameDurationVariation: 400
              to: { "left" : 1, "right" : 1 }
          }

          Sprite {
              name: "right"
              source: "../gfx/mob-idle.png"
              frameCount: 1
              frameX: 128
              frameWidth: 64
              frameHeight: 64
              frameDuration: 800
              frameDurationVariation: 400
              to: { "front" : 1 }
          }

</pre>
<p>In the <code>fishSprite</code> sprite sequence, each sprite defines one frame within the mob-idle.png file, which shows a fish facing right, front, and left:</p>
<p class="centerAlign"><img src="images/mob-idle.png" alt="" /></p><p>We use the <code>frameWidth</code>, <code>frameHeight</code>, and <code>frameX</code> properties to determine that the first 64x64-pixel square of the image is framed in the <code>&quot;left&quot;</code> sprite, the second in the <code>&quot;front&quot;</code> sprite, and the third in the <code>&quot;right&quot;</code> sprite. For each sprite, the <code>frameCount</code> property is set to <code>1</code> to specify that the sprite contains one frame.</p>
<p>We use the <code>frameDuration</code> and <code>frameDurationVariation</code> properties to specify that the duration of an animation can vary from <code>400</code> to <code>1200</code> milliseconds.</p>
<p>The <code>to</code> property specifies that the sprites have weighted transitions to other sprites. The <code>&quot;left&quot;</code> and <code>&quot;right&quot;</code> sprites always transfer to the <code>&quot;front&quot;</code> sprite. When the <code>&quot;front&quot;</code> animation finishes, the sprite engine chooses <code>&quot;left&quot;</code> or <code>&quot;right&quot;</code> randomly, but at roughly equal proportions, because they both have the weight <code>1</code>.</p>
<p>When the fish are set free, we want them to swim away in the direction they are facing until they get off the screen. If they were facing front, we use the <code>jumpTo</code> method with the JavaScript <code>Math.random()</code> method in the <code>die()</code> private function to randomly jump to the <code>&quot;left&quot;</code> or <code>&quot;right&quot;</code> sprite:</p>
<pre class="cpp">

      function die() {
          if (dying)
              return;
          dying = true;
          bubble.jumpTo("burst");
          if (fishSprite.currentSprite == "front")
              fishSprite.jumpTo(Math.random() > 0.5 ? "left" : "right" );
          fishSwim.start();
          Logic.gameState.score += 1;
          killedSound.play();
          bubble.scale = 0.9
          destroy(350);
      }

</pre>
<p>We then use the <code>start()</code> function to run a NumberAnimation that applies a number animation to the x value from its current value to <code>-360</code> or <code>360</code>, depending on whether the <code>goingLeft</code> custom property is <code>true</code>, in 300 milliseconds:</p>
<pre class="cpp">

          NumberAnimation on x {
              id: fishSwim
              running: false
              property bool goingLeft: fishSprite.currentSprite == "right"
              to: goingLeft ? -360 : 360
              duration: 300
          }

</pre>
<a name="bursting-bubbles"></a>
<h3 id="bursting-bubbles">Bursting Bubbles</h3>
<p>We use another SpriteSequence to animate the bubbles so that they become smaller and finally burst when they are attacked by a shooter or a melee. For this effect, we set the value of the <code>scale</code> property to decrease by <code>0.2</code> each time the custom <code>hp</code> property changes:</p>
<pre class="cpp">

      SpriteSequence {
          id: bubble
          width: 64
          height: 64
          scale: 0.4 + (0.2  * hp)
          interpolate: false
          goalSprite: ""

</pre>
<p>We use a Behavior type to apply a NumberAnimation when the value of <code>scale</code> changes. We use the <code>Easing.OutBack</code> easing type for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out curve that decelerates the motion to zero velocity in 150 milliseconds:</p>
<pre class="cpp">

          Behavior on scale {
              NumberAnimation { duration: 150; easing.type: Easing.OutBack }
          }

</pre>
<p>The SpriteSequence consist of two sprites that display different images. The first sprite, <code>&quot;big&quot;</code>, uses the catch.png image to display an empty bubble:</p>
<pre class="cpp">

          Sprite {
              name: "big"
              source: "../gfx/catch.png"
              frameCount: 1
              to: { "burst" : 0 }
          }

</pre>
<p>We set the <code>to</code> property to <code>&quot;burst&quot;</code> with the weight <code>0</code> to make the second sprite, <code>&quot;burst&quot;</code>, a valid goal for the <code>jumpTo</code> method that we use in the <code>die()</code> private function to jump directly to the <code>&quot;burst&quot;</code> sprite without playing the first sprite.</p>
<p>In the <code>&quot;burst&quot;</code> sprite, we set the <code>frameCount</code> property to <code>3</code> and the <code>frameX</code> property to <code>64</code> to specify that the animation starts at pixel location 64 and loads each frame for the duration of 200 milliseconds.</p>
<pre class="cpp">

          Sprite {
              name: "burst"
              source: "../gfx/catch-action.png"
              frameCount: 3
              frameX: 64
              frameDuration: 200
          }

</pre>
<p>Within the SpriteSequence, we use SequentialAnimation with NumberAnimation to animate the transitions between the frames. To create a pulsating effect on the bubbles, we apply a sequential animation on the <code>width</code> property with two number animations to first increase the bubble width from <code>* 1</code> to <code>* 1.1</code> over 800 milliseconds and then bring it back over 1 second:</p>
<pre class="cpp">

          SequentialAnimation on width {
              loops: Animation.Infinite
              NumberAnimation { from: width * 1; to: width * 1.1; duration: 800; easing.type: Easing.InOutQuad }
              NumberAnimation { from: width * 1.1; to: width * 1; duration: 1000; easing.type: Easing.InOutQuad }
          }

</pre>
<p>Similarly, we increase the bubble height from <code>* 1</code> to <code>* 1.15</code> over 1200 milliseconds and then bring it back over 1 second:</p>
<pre class="cpp">

          SequentialAnimation on height {
              loops: Animation.Infinite
              NumberAnimation { from: height * 1; to: height * 1.15; duration: 1200; easing.type: Easing.InOutQuad }
              NumberAnimation { from: height * 1.15; to: height * 1; duration: 1000; easing.type: Easing.InOutQuad }
          }

</pre>
<p>We use yet another SpriteSequence to display the effect of squid ink on the bubbles. For more examples of using sprite sequences, see the QML files in the <code>towers</code> directory.</p>
<a name="adding-dialogs"></a>
<h2 id="adding-dialogs">Adding Dialogs</h2>
<p class="centerAlign"><img src="images/qtquick-demo-maroon-med-5.jpg" alt="" /></p><p>In GameCanvas.qml, we use an Image type with some custom properties to create a menu where the players can buy tower objects:</p>
<pre class="cpp">

      Image {
          id: towerMenu
          visible: false
          z: 1500
          scale: 0.9
          opacity: 0.7
          property int dragDistance: 16
          property int targetRow: 0
          property int targetCol: 0
          property bool shown: false
          property bool towerExists: false

</pre>
<p>We set the <code>visible</code> property to <code>false</code> to hide the menu by default. The <code>z</code> property is set to 1500 to ensure that the menu is displayed in front of all other items when it is visible.</p>
<p>We use a MouseArea type to open or close the menu when players tap on the canvas:</p>
<pre class="cpp">

      MouseArea {
          id: ma
          anchors.fill: parent
          onClicked: {
              if (towerMenu.visible)
                  towerMenu.finish()
              else
                  towerMenu.open(mouse.x, mouse.y)
          }
      }

</pre>
<p>We set the <code>anchors.fill</code> property to <code>parent</code> to allow the players to tap anywhere on the game canvas. We use a condition in the <code>onClicked</code> signal handler to call the <code>finish()</code> function if the menu is visible and the <code>open()</code> function otherwise.</p>
<p>The <code>finish()</code> function hides the menu by setting the <code>shown</code> custom property to <code>false</code>:</p>
<pre class="cpp">

          function finish() {
              shown = false
          }

</pre>
<p>The <code>open()</code> function displays the menu at the x and y position of the mouse pointer:</p>
<pre class="cpp">

          function open(xp,yp) {
              if (!grid.gameRunning)
                  return
              targetRow = Logic.row(yp)
              targetCol = Logic.col(xp)
              if (targetRow == 0)
                  towerMenu.y = (targetRow + 1) * grid.squareSize
              else
                  towerMenu.y = (targetRow - 1) * grid.squareSize
              towerExists = (grid.towers[Logic.towerIdx(targetCol, targetRow)] != null)
              shown = true
              helpButton.goAway();
          }

</pre>
<p>If <code>gameRunning</code> is <code>true</code>, we call the JavaScript <code>row()</code> function to calculate the value of the <code>targetRow</code> custom property and the <code>col()</code> function to calculate the value of the <code>targetCol</code> custom property. If the value of <code>targetRow</code> equals <code>0</code>, the y position is set to one square above the mouse pointer. Otherwise, it is set to one square below the mouse pointer.</p>
<p>We use the <code>towerIdx()</code> function to set the value of the <code>towerExists</code> custom property.</p>
<p>We set the <code>shown</code> custom property to <code>true</code> to show the menu and call the <code>helpButton.goAway()</code> function to hide the help button when the menu opens.</p>
<p>We use states and transitions to display the menu when the <code>shown</code> property is <code>true</code> and the <code>gameOver</code> property is <code>false</code>:</p>
<pre class="cpp">

          states: State {
              name: "shown"; when: towerMenu.shown && !grid.gameOver
              PropertyChanges { target: towerMenu; visible: true; scale: 1; opacity: 1 }
          }

          transitions: Transition {
              PropertyAction { property: "visible" }
              NumberAnimation { properties: "opacity,scale"; duration: 500; easing.type: Easing.OutElastic }
          }

</pre>
<p>To set the visibility of the menu to <code>&quot;visible&quot;</code> without animating the property change, we use a PropertyAction type. We do want to animate the changes in opacity and scale, though, so we use number animation to animate the value of the <code>scale</code> property from <code>0.9</code> to <code>1</code> and the value of <code>opacity</code> property from <code>0.7</code> to <code>1</code>, over 500 milliseconds. We use the <code>Easing.outElastic</code> easing type for an elastic (exponentially decaying sine wave) function easing curve that decelerates from zero velocity.</p>
<p>To construct the menu, we use a BuildButton custom type that is defined in BuildButton.qml. In GameCanvas.qml, we create one build button for each tower object that the players can buy and position them in a Row layout in front of the menu background image, dialog.png:</p>
<pre class="cpp">

          x: -32
          source: "gfx/dialog.png"
          Row {
              id: buttonRow
              height: 100
              anchors.centerIn: parent
              spacing: 8
              BuildButton {
                  row: towerMenu.targetRow; col: towerMenu.targetCol
                  anchors.verticalCenter: parent.verticalCenter
                  towerType: 1; index: 0
                  canBuild: !towerMenu.towerExists
                  source: "gfx/dialog-melee.png"
                  onClicked: towerMenu.finish()
              }
              BuildButton {
                  row: towerMenu.targetRow; col: towerMenu.targetCol
                  anchors.verticalCenter: parent.verticalCenter
                  towerType: 2; index: 1
                  canBuild: !towerMenu.towerExists
                  source: "gfx/dialog-shooter.png"
                  onClicked: towerMenu.finish()
              }
              BuildButton {
                  row: towerMenu.targetRow; col: towerMenu.targetCol
                  anchors.verticalCenter: parent.verticalCenter
                  towerType: 3; index: 2
                  canBuild: !towerMenu.towerExists
                  source: "gfx/dialog-bomb.png"
                  onClicked: towerMenu.finish()
              }
              BuildButton {
                  row: towerMenu.targetRow; col: towerMenu.targetCol
                  anchors.verticalCenter: parent.verticalCenter
                  towerType: 4; index: 3
                  canBuild: !towerMenu.towerExists
                  source: "gfx/dialog-factory.png"
                  onClicked: towerMenu.finish()
              }
          }
      }

</pre>
<p>For each build button, we set the values of <code>towerType</code> and <code>index</code> custom properties that we define in BuildButton.qml.</p>
<p>We use the <code>canBuild</code> custom property to prevent players from adding tower objects in locations where tower objects already exist.</p>
<p>We use the <code>source</code> property to display the image for the tower type.</p>
<p>The <code>onClicked</code> signal handler is called to execute the <code>finish()</code> function that closes the menu when the players tap an enabled build button.</p>
<p>Build buttons are enabled when the players have enough coins to buy the tower objects. We use an Image type in BuildButton.qml to display images on the buttons:</p>
<pre class="cpp">

      Image {
          id: img
          opacity: (canBuild && gameCanvas.coins >= Logic.towerData[towerType-1].cost) ? 1.0 : 0.4
      }

</pre>
<p>We use the <code>opacity</code> property to make the buttons appear enabled. If <code>canBuild</code> is <code>true</code> and the value of the <code>gameCanvas.coins</code> property is larger than or equal to the cost of a tower object, the images are fully opaque, otherwise their opacity is set to <code>0.4</code>.</p>
<p>We use a Text type to display the cost of each tower item, as specified by the <code>towerData</code> variable, depending on <code>towerType</code>:</p>
<pre class="cpp">

      Text {
          anchors.right: parent.right
          font.pointSize: 14
          font.bold: true
          color: "#ffffff"
          text: Logic.towerData[towerType - 1].cost
      }

</pre>
<p>To display a pointer on the screen at the position where the tower object will be added, we use the Image type. We use the <code>visible</code> property to determine whether the dialog-pointer.png image should be positioned below or above the menu. When the value of the <code>col</code> property equals the <code>index</code> and the value or the <code>row</code> property is not <code>0</code>, we anchor the image to the bottom of its parent, BuildButton.</p>
<p>When the value or the <code>row</code> property is <code>0</code>, we anchor the image to the top of BuildButton to position the pointer above the menu and use the <code>rotation</code> property to rotate it by 180 degrees, so that it points upwards:</p>
<pre class="cpp">

      Image {
          visible: col == index && row != 0
          source: "gfx/dialog-pointer.png"
          anchors.top: parent.bottom
          anchors.topMargin: 4
          anchors.horizontalCenter: parent.horizontalCenter
      }
      Image {
          visible: col == index && row == 0
          source: "gfx/dialog-pointer.png"
          rotation: 180
          anchors.bottom: parent.top
          anchors.bottomMargin: 6
          anchors.horizontalCenter: parent.horizontalCenter
      }

</pre>
<a name="keeping-track-of-game-statistics"></a>
<h2 id="keeping-track-of-game-statistics">Keeping Track of Game Statistics</h2>
<p>To keep track of the game statistics, we use the InfoBar custom type (that is defined in InfoBar.qml) in maroon.qml:</p>
<pre class="cpp">

              InfoBar { anchors.bottom: canvas.top; anchors.bottomMargin: 6; width: parent.width }

</pre>
<p>We use the <code>anchors.bottom</code> and <code>anchors.bottomMargin</code> properties to position the info bar at 6 points from the top of the game canvas. We bind the <code>width</code> property of the info bar to that of its parent.</p>
<p>In InfoBar.qml, we use an Item type to create the info bar. Within it, we use a Row layout type to display the number of lives the players have left, the number of fish that have been saved, and the amount of coins that are available for use.</p>
<p>We use the <code>anchors</code> property to position the rows in relationship to their parent and to each other. In the first Row object, we use the <code>anchors.left</code> and <code>anchors.leftMargin</code> properties to position the heart icons at 10 points from the left border of the parent item:</p>
<pre class="cpp">

  Item {
      height: childrenRect.height

      // Display the number of lives
      Row {
          anchors.left: parent.left
          anchors.leftMargin: 10
          spacing: 5
          Repeater {
              id: rep
              model: Math.min(10, canvas.lives)
              delegate: Image { source: "gfx/lifes.png" }
          }
      }

</pre>
<p>We use a Repeater type with a <code>model</code> and a <code>delegate</code> to display as many hearts as the players have lives left. We use the <code>spacing</code> property to leave 5 pixels between the displayed icons.</p>
<p>In the second Row object, we use the <code>anchors.right</code> and <code>anchors.rightMargin</code> properties to position the number of fish saved at 20 points left of the third Row object that displays the number of coins available (and has the id <code>points</code>):</p>
<pre class="cpp">

      Row {
          anchors.right: points.left
          anchors.rightMargin: 20
          spacing: 5
          Image { source: "gfx/scores.png" }
          Text {
              text: canvas.score
              font.bold: true
          }
      }

      // Display the number of coins
      Row {
          id: points
          anchors.right: parent.right
          anchors.rightMargin: 10
          spacing: 5
          Image { source: "gfx/points.png" }
          Text {
              id: pointsLabel
              text: canvas.coins
              font.bold: true
          }
      }
  }

</pre>
<p>In these objects, we set spacing to 5 pixels to separate the icons from the numbers that we display by using a Text type.</p>
<p>In GameCanvas.qml, we define custom properties to hold the game statistics:</p>
<pre class="cpp">

      property int score: 0
      property int coins: 100
      property int lives: 3

</pre>
<p>We declare the <code>freshState()</code> function to set the initial game statistics when a new game starts:</p>
<pre class="cpp">

      function freshState() {
          lives = 3
          coins = 100
          score = 0
          waveNumber = 0
          waveProgress = 0
          gameOver = false
          gameRunning = false
          towerMenu.shown = false
          helpButton.comeBack();
      }

</pre>
<p>We use the <code>Logic.gameState.score</code> variable in the <code>die()</code> function that we declare in MobBase.qml to increase the score by one when the players set a fish free:</p>
<pre class="cpp">

          Logic.gameState.score += 1;

</pre>
<a name="managing-game-states"></a>
<h2 id="managing-game-states">Managing Game States</h2>
<p>In maroon.qml, we use a State type and JavaScript to switch between screens according to the game state. The logic.js file contains definitions for the functions. To use the functions in a QML file, we import logic.js as the <code>Logic</code> namespace in that file:</p>
<pre class="cpp">

  import "content/logic.js" as Logic

</pre>
<p>The base state displays the new game screen when the application starts. In addition, we call the Component.onCompleted signal handler to initialize a new game:</p>
<pre class="cpp">

      Component.onCompleted: gameState = Logic.newGameState(canvas);

</pre>
<p>In NewGameScreen.qml we use the <code>onClicked</code> signal handler to emit the <code>startButtonClicked()</code> signal when the players tap the New Game button:</p>
<pre class="cpp">

      Image {
          source: "gfx/button-play.png"
          anchors.bottom: parent.bottom
          anchors.bottomMargin: 60
          MouseArea {
              anchors.fill: parent
              onClicked: newGameScreen.startButtonClicked()
          }

</pre>
<p>In maroon.qml, we use the <code>onStartButtonClicked</code> signal handler to set the <code>passedSplash</code> property of the <code>root</code> item to <code>true</code>:</p>
<pre class="cpp">

          NewGameScreen {
              onStartButtonClicked: root.passedSplash = true
          }

</pre>
<p>We then use the <code>passedSplash</code> property in the <code>when</code> property of the <code>gameOn</code> state to trigger the <code>gameStarter</code> timer:</p>
<pre class="cpp">

          State {
              name: "gameOn"; when: gameState.gameOver == false && passedSplash
              PropertyChanges { target: view; y: -(height - 960) }
              StateChangeScript { script: root.countdown = 0; }
              PropertyChanges { target: gameStarter; running: true }
          },

</pre>
<p>We also switch to the <code>&quot;gameOn&quot;</code> state and move to the y position <code>-(height - 960)</code> to display the game canvas.</p>
<p>In the <code>gameStarter</code> <a href="qtquick-debugging.html#timer">Timer</a> object we use the <code>onTriggered</code> signal handler to call the <code>startGame()</code> function that starts a new game:</p>
<pre class="cpp">

      Timer {
          id: gameStarter
          interval: 4000
          running: false
          repeat: false
          onTriggered: Logic.startGame(canvas);
      }

</pre>
<p>The game continues until <code>gameState.gameOver</code> is set to <code>true</code> and <code>gameState.gameRunning</code> is set to <code>false</code> by calling the <code>endGame()</code> function when the value of the <code>gameState.lives</code> property becomes less than or equal to <code>0</code>.</p>
<p>In GameOverScreen.qml, we use a MouseArea type and an <code>onClicked</code> signal handler within an Image type to return to the game canvas when the players tap the New Game button:</p>
<pre class="cpp">

      Image {
          source: "gfx/button-play.png"
          anchors.bottom: parent.bottom
          anchors.bottomMargin: 0
          MouseArea {
              anchors.fill: parent
              onClicked: gameCanvas.gameOver = false//This will actually trigger the state change in main.qml
          }
      }

</pre>
<p>The <code>onClicked</code> signal handler triggers a state change in maroon.qml to display the game canvas:</p>
<pre class="cpp">

          State {
              name: "gameOver"; when: gameState.gameOver == true
              PropertyChanges { target: view; y: 0 }
          }

</pre>
<a name="playing-sound-effects"></a>
<h2 id="playing-sound-effects">Playing Sound Effects</h2>
<p>The app can play sound effects if the Qt Multimedia module is installed. In the SoundEffect.qml file, we proxy a SoundEffect type:</p>
<pre class="cpp">

  Item {
      id: container
      property QtObject effect: Qt.createQmlObject("import QtMultimedia 5.0; SoundEffect{ source: '" + container.source + "'; muted: Qt.application.state != Qt.ApplicationActive }", container);
      property url source: ""
      onSourceChanged: if (effect != null) effect.source = source;
      function play() {
          if (effect != null)
              effect.play();
      }

</pre>
<p>We add the <code>qtHaveModule()</code> qmake command to the app .pro file, maroon.pro, to check whether the Qt Multimedia module is present:</p>
<pre class="cpp">

  QT += qml quick
  qtHaveModule(multimedia): QT += multimedia

</pre>
<p>In each QML file that defines a custom type used on the game canvas, we use a SoundEffect type to specify the audio file to play for that type of objects. For example, in Bomb.qml, we specify the sound that a bomb makes when it explodes:</p>
<pre class="cpp">

      SoundEffect {
          id: sound
          source: "../audio/bomb-action.wav"
      }

</pre>
<p>To play the sound effect when a bomb explodes, we call the <code>sound.play()</code> function that we declare as a member of the private <code>fire()</code> function within the TowerBase custom type:</p>
<pre class="cpp">

      function fire() {
          sound.play()
          sprite.jumpTo("shoot")
          animDelay.start()
      }

</pre>
<p>For more examples of playing sound effects, see the QML files in the <code>towers</code> directory and MobBase.qml.</p>
<a name="adding-keyboard-shortcuts"></a>
<h2 id="adding-keyboard-shortcuts">Adding Keyboard Shortcuts</h2>
<p>This is a touch example, so you should not really need to handle key presses. However, we do not want you to have to spend more time playing the game than you want to while testing it, so we use the <code>Keys.onPressed</code> signal handler to specify keyboard shortcuts. You can press Shift+Up to increment the values of the <code>coins</code> property to add coins, Shift+Left to increment the value of <code>lives</code>, Shift+Down to increment the value of the <code>waveProgress</code> property to spawn mobs of fish faster, and Shift+Right to call the <code>endGame()</code> function to quit the game:</p>
<pre class="cpp">

      Keys.onPressed: { // Cheat Codes while Testing
          if (event.key == Qt.Key_Up && (event.modifiers & Qt.ShiftModifier))
              grid.coins += 10;
          if (event.key == Qt.Key_Left && (event.modifiers & Qt.ShiftModifier))
              grid.lives += 1;
          if (event.key == Qt.Key_Down && (event.modifiers & Qt.ShiftModifier))
              Logic.gameState.waveProgress += 1000;
          if (event.key == Qt.Key_Right && (event.modifiers & Qt.ShiftModifier))
              Logic.endGame();
      }

</pre>
<a name="packaging-resources-for-deployment"></a>
<h2 id="packaging-resources-for-deployment">Packaging Resources for Deployment</h2>
<p>To be able to run the app on mobile devices, we package all QML, JavaScript, image, and sound files into a Qt resource file (.qrc). For more information, see The Qt Resource System.</p>
<p>Files:</p>
<ul>
<li><a href="qtdoc-demos-maroon-content-buildbutton-qml.html">demos/maroon/content/BuildButton.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-gamecanvas-qml.html">demos/maroon/content/GameCanvas.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-gameoverscreen-qml.html">demos/maroon/content/GameOverScreen.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-infobar-qml.html">demos/maroon/content/InfoBar.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-newgamescreen-qml.html">demos/maroon/content/NewGameScreen.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-soundeffect-qml.html">demos/maroon/content/SoundEffect.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-logic-js.html">demos/maroon/content/logic.js</a></li>
<li><a href="qtdoc-demos-maroon-content-mobs-mobbase-qml.html">demos/maroon/content/mobs/MobBase.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-towers-bomb-qml.html">demos/maroon/content/towers/Bomb.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-towers-factory-qml.html">demos/maroon/content/towers/Factory.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-towers-melee-qml.html">demos/maroon/content/towers/Melee.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-towers-ranged-qml.html">demos/maroon/content/towers/Ranged.qml</a></li>
<li><a href="qtdoc-demos-maroon-content-towers-towerbase-qml.html">demos/maroon/content/towers/TowerBase.qml</a></li>
<li><a href="qtdoc-demos-maroon-main-cpp.html">demos/maroon/main.cpp</a></li>
<li><a href="qtdoc-demos-maroon-maroon-pro.html">demos/maroon/maroon.pro</a></li>
<li><a href="qtdoc-demos-maroon-maroon-qml.html">demos/maroon/maroon.qml</a></li>
<li><a href="qtdoc-demos-maroon-maroon-qmlproject.html">demos/maroon/maroon.qmlproject</a></li>
<li><a href="qtdoc-demos-maroon-maroon-qrc.html">demos/maroon/maroon.qrc</a></li>
</ul>
<p>Images:</p>
<ul>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/background.png">demos/maroon/content/gfx/background.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/bomb-action.png">demos/maroon/content/gfx/bomb-action.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/bomb-idle.png">demos/maroon/content/gfx/bomb-idle.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/bomb.png">demos/maroon/content/gfx/bomb.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/button-help.png">demos/maroon/content/gfx/button-help.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/button-play.png">demos/maroon/content/gfx/button-play.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/catch-action.png">demos/maroon/content/gfx/catch-action.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/catch.png">demos/maroon/content/gfx/catch.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/cloud.png">demos/maroon/content/gfx/cloud.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/currency.png">demos/maroon/content/gfx/currency.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/dialog-bomb.png">demos/maroon/content/gfx/dialog-bomb.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/dialog-factory.png">demos/maroon/content/gfx/dialog-factory.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/dialog-melee.png">demos/maroon/content/gfx/dialog-melee.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/dialog-pointer.png">demos/maroon/content/gfx/dialog-pointer.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/dialog-shooter.png">demos/maroon/content/gfx/dialog-shooter.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/dialog.png">demos/maroon/content/gfx/dialog.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/factory-action.png">demos/maroon/content/gfx/factory-action.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/factory-idle.png">demos/maroon/content/gfx/factory-idle.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/factory.png">demos/maroon/content/gfx/factory.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/grid.png">demos/maroon/content/gfx/grid.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/help.png">demos/maroon/content/gfx/help.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/lifes.png">demos/maroon/content/gfx/lifes.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/logo-bubble.png">demos/maroon/content/gfx/logo-bubble.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/logo-fish.png">demos/maroon/content/gfx/logo-fish.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/logo.png">demos/maroon/content/gfx/logo.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/melee-action.png">demos/maroon/content/gfx/melee-action.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/melee-idle.png">demos/maroon/content/gfx/melee-idle.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/melee.png">demos/maroon/content/gfx/melee.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/mob-idle.png">demos/maroon/content/gfx/mob-idle.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/mob.png">demos/maroon/content/gfx/mob.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/points.png">demos/maroon/content/gfx/points.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/projectile-action.png">demos/maroon/content/gfx/projectile-action.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/projectile.png">demos/maroon/content/gfx/projectile.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/scores.png">demos/maroon/content/gfx/scores.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/shooter-action.png">demos/maroon/content/gfx/shooter-action.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/shooter-idle.png">demos/maroon/content/gfx/shooter-idle.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/shooter.png">demos/maroon/content/gfx/shooter.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/sunlight.png">demos/maroon/content/gfx/sunlight.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/text-1.png">demos/maroon/content/gfx/text-1.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/text-2.png">demos/maroon/content/gfx/text-2.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/text-3.png">demos/maroon/content/gfx/text-3.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/text-blank.png">demos/maroon/content/gfx/text-blank.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/text-gameover.png">demos/maroon/content/gfx/text-gameover.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/text-go.png">demos/maroon/content/gfx/text-go.png</a></li>
<li><a href="images/used-in-examples/demos/maroon/content/gfx/wave.png">demos/maroon/content/gfx/wave.png</a></li>
</ul>
</div>
<p><b>See also </b><a href="qmlapplications.html">QML Applications</a>.</p>
<!-- @@@demos/maroon -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>