diff options
Diffstat (limited to 'examples/quick/demos/maroon')
78 files changed, 0 insertions, 3159 deletions
diff --git a/examples/quick/demos/maroon/content/BuildButton.qml b/examples/quick/demos/maroon/content/BuildButton.qml deleted file mode 100644 index 09d37746f1..0000000000 --- a/examples/quick/demos/maroon/content/BuildButton.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "logic.js" as Logic - -Item { - id: container - width: 64 - height: 64 - property alias source: img.source - property int index - property int row: 0 - property int col: 0 - property int towerType - property bool canBuild: true - property Item gameCanvas: parent.parent.parent - signal clicked() - - Image { - id: img - opacity: (canBuild && gameCanvas.coins >= Logic.towerData[towerType-1].cost) ? 1.0 : 0.4 - } - Text { - anchors.right: parent.right - font.pointSize: 14 - font.bold: true - color: "#ffffff" - text: Logic.towerData[towerType - 1].cost - } - MouseArea { - anchors.fill: parent - onClicked: { - Logic.buildTower(towerType, col, row) - container.clicked() - } - } - 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 - } -} diff --git a/examples/quick/demos/maroon/content/GameCanvas.qml b/examples/quick/demos/maroon/content/GameCanvas.qml deleted file mode 100644 index 0c6772dc98..0000000000 --- a/examples/quick/demos/maroon/content/GameCanvas.qml +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "logic.js" as Logic -import "towers" as Towers - -Item { - id: grid - - property int squareSize: 64 - property int rows: 6 - property int cols: 4 - property Item canvas: grid - property int score: 0 - property int coins: 100 - property int lives: 3 - property int waveNumber: 0 - property int waveProgress: 0 - property var towers - property var mobs - property bool gameRunning: false - property bool gameOver: false - property bool errored: false - property string errorString: "" - - width: cols * squareSize - height: rows * squareSize - - function freshState() { - lives = 3 - coins = 100 - score = 0 - waveNumber = 0 - waveProgress = 0 - gameOver = false - gameRunning = false - towerMenu.shown = false - helpButton.comeBack(); - } - - Text { - id: errorText // Mostly for debug purposes - text: errorString - visible: errored - color: "red" - font.pixelSize: 18 - wrapMode: Text.WordWrap - width: parent.width / 1.2 - height: parent.height / 1.2 - anchors.centerIn: parent - z: 1000 - } - - Timer { - interval: 16 - running: true - repeat: true - onTriggered: Logic.tick() - } - - MouseArea { - id: ma - anchors.fill: parent - onClicked: { - if (towerMenu.visible) - towerMenu.finish() - else - towerMenu.open(mouse.x, mouse.y) - } - } - - 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 - - function finish() { - shown = false - } - - 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(); - } - - 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 } - } - - 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() - } - } - } - - - 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(); - } - - 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 - } - - Image { - id: helpImage - z: 1010 - source: "gfx/help.png" - anchors.fill: parent - visible: false - MouseArea { - anchors.fill: parent - onClicked: helpImage.visible = false; - } - } - -} diff --git a/examples/quick/demos/maroon/content/GameOverScreen.qml b/examples/quick/demos/maroon/content/GameOverScreen.qml deleted file mode 100644 index 6de3b13bad..0000000000 --- a/examples/quick/demos/maroon/content/GameOverScreen.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "logic.js" as Logic - -Item { - id: gameOverScreen - width: 320 - height: 400 - property GameCanvas gameCanvas - - Image { - id: img - source: "gfx/text-gameover.png" - anchors.centerIn: parent - } - - ParticleSystem { - anchors.fill: parent - ImageParticle { - id: cloud - source: "gfx/cloud.png" - alphaVariation: 0.25 - opacity: 0.25 - } - - Wander { - xVariance: 100; - pace: 1; - } - - Emitter { - id: cloudLeft - width: 160 - height: 160 - anchors.right: parent.left - emitRate: 0.5 - lifeSpan: 12000 - velocity: PointDirection{ x: 64; xVariation: 2; yVariation: 2 } - size: 160 - } - - Emitter { - id: cloudRight - width: 160 - height: 160 - anchors.left: parent.right - emitRate: 0.5 - lifeSpan: 12000 - velocity: PointDirection{ x: -64; xVariation: 2; yVariation: 2 } - size: 160 - } - } - - - Text { - visible: gameCanvas != undefined - text: "You saved " + gameCanvas.score + " fishes!" - anchors.top: img.bottom - anchors.topMargin: 12 - anchors.horizontalCenter: parent.horizontalCenter - font.bold: true - color: "#000000" - opacity: 0.5 - } - - 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 - } - } -} diff --git a/examples/quick/demos/maroon/content/InfoBar.qml b/examples/quick/demos/maroon/content/InfoBar.qml deleted file mode 100644 index 8176b1a37e..0000000000 --- a/examples/quick/demos/maroon/content/InfoBar.qml +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -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" } - } - } - - // Display the number of fishes saved - 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 - } - } -} - diff --git a/examples/quick/demos/maroon/content/NewGameScreen.qml b/examples/quick/demos/maroon/content/NewGameScreen.qml deleted file mode 100644 index d87e6b36f7..0000000000 --- a/examples/quick/demos/maroon/content/NewGameScreen.qml +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -// This is the first screen. -// It shows the logo and emit a startButtonClicked signal -// when the user press the "PLAY" button. - -Item { - id: newGameScreen - width: 320 - height: 480 - - signal startButtonClicked - - Image { - source: "gfx/logo.png" - anchors.top: parent.top - anchors.topMargin: 60 - } - - Image { - source: "gfx/logo-fish.png" - anchors.top: parent.top - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x + 148; to: x + 25; duration: 2000; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 25; to: x + 148; duration: 1600; easing.type: Easing.InOutQuad } - } - SequentialAnimation on anchors.topMargin { - loops: Animation.Infinite - NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "gfx/logo-bubble.png" - anchors.top: parent.top - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x + 140; to: x + 40; duration: 2000; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 40; to: x + 140; duration: 1600; easing.type: Easing.InOutQuad } - } - SequentialAnimation on anchors.topMargin { - loops: Animation.Infinite - NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } - } - SequentialAnimation on width { - loops: Animation.Infinite - NumberAnimation { from: 140; to: 160; duration: 1000; easing.type: Easing.InOutQuad } - NumberAnimation { from: 160; to: 140; duration: 800; easing.type: Easing.InOutQuad } - } - SequentialAnimation on height { - loops: Animation.Infinite - NumberAnimation { from: 150; to: 140; duration: 800; easing.type: Easing.InOutQuad } - NumberAnimation { from: 140; to: 150; duration: 1000; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "gfx/button-play.png" - anchors.bottom: parent.bottom - anchors.bottomMargin: 60 - MouseArea { - anchors.fill: parent - onClicked: newGameScreen.startButtonClicked() - } - } -} diff --git a/examples/quick/demos/maroon/content/SoundEffect.qml b/examples/quick/demos/maroon/content/SoundEffect.qml deleted file mode 100644 index 35a68eb5e0..0000000000 --- a/examples/quick/demos/maroon/content/SoundEffect.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -//Proxies a SoundEffect if QtMultimedia is installed -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(); - } -} diff --git a/examples/quick/demos/maroon/content/audio/bomb-action.wav b/examples/quick/demos/maroon/content/audio/bomb-action.wav Binary files differdeleted file mode 100644 index b334dc1e5b..0000000000 --- a/examples/quick/demos/maroon/content/audio/bomb-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/catch-action.wav b/examples/quick/demos/maroon/content/audio/catch-action.wav Binary files differdeleted file mode 100644 index 3e22124abf..0000000000 --- a/examples/quick/demos/maroon/content/audio/catch-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/catch.wav b/examples/quick/demos/maroon/content/audio/catch.wav Binary files differdeleted file mode 100644 index d3eade87f8..0000000000 --- a/examples/quick/demos/maroon/content/audio/catch.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/currency.wav b/examples/quick/demos/maroon/content/audio/currency.wav Binary files differdeleted file mode 100644 index 0d9ef2c200..0000000000 --- a/examples/quick/demos/maroon/content/audio/currency.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/factory-action.wav b/examples/quick/demos/maroon/content/audio/factory-action.wav Binary files differdeleted file mode 100644 index a2ace6c221..0000000000 --- a/examples/quick/demos/maroon/content/audio/factory-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/melee-action.wav b/examples/quick/demos/maroon/content/audio/melee-action.wav Binary files differdeleted file mode 100644 index d325af4700..0000000000 --- a/examples/quick/demos/maroon/content/audio/melee-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/projectile-action.wav b/examples/quick/demos/maroon/content/audio/projectile-action.wav Binary files differdeleted file mode 100644 index 4e2284fceb..0000000000 --- a/examples/quick/demos/maroon/content/audio/projectile-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/audio/shooter-action.wav b/examples/quick/demos/maroon/content/audio/shooter-action.wav Binary files differdeleted file mode 100644 index 3e12b9419a..0000000000 --- a/examples/quick/demos/maroon/content/audio/shooter-action.wav +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/background.png b/examples/quick/demos/maroon/content/gfx/background.png Binary files differdeleted file mode 100644 index d548b9314e..0000000000 --- a/examples/quick/demos/maroon/content/gfx/background.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/bomb-action.png b/examples/quick/demos/maroon/content/gfx/bomb-action.png Binary files differdeleted file mode 100644 index 42da5d789f..0000000000 --- a/examples/quick/demos/maroon/content/gfx/bomb-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/bomb-idle.png b/examples/quick/demos/maroon/content/gfx/bomb-idle.png Binary files differdeleted file mode 100644 index 3bd62e261d..0000000000 --- a/examples/quick/demos/maroon/content/gfx/bomb-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/bomb.png b/examples/quick/demos/maroon/content/gfx/bomb.png Binary files differdeleted file mode 100644 index 380da7d1a5..0000000000 --- a/examples/quick/demos/maroon/content/gfx/bomb.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/button-help.png b/examples/quick/demos/maroon/content/gfx/button-help.png Binary files differdeleted file mode 100644 index aecebc1275..0000000000 --- a/examples/quick/demos/maroon/content/gfx/button-help.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/button-play.png b/examples/quick/demos/maroon/content/gfx/button-play.png Binary files differdeleted file mode 100644 index 6cdad6c845..0000000000 --- a/examples/quick/demos/maroon/content/gfx/button-play.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/catch-action.png b/examples/quick/demos/maroon/content/gfx/catch-action.png Binary files differdeleted file mode 100644 index 78ca9fe1cc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/catch-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/catch.png b/examples/quick/demos/maroon/content/gfx/catch.png Binary files differdeleted file mode 100644 index b7620fe3de..0000000000 --- a/examples/quick/demos/maroon/content/gfx/catch.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/cloud.png b/examples/quick/demos/maroon/content/gfx/cloud.png Binary files differdeleted file mode 100644 index d7c35f8555..0000000000 --- a/examples/quick/demos/maroon/content/gfx/cloud.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/currency.png b/examples/quick/demos/maroon/content/gfx/currency.png Binary files differdeleted file mode 100644 index 1571341f6c..0000000000 --- a/examples/quick/demos/maroon/content/gfx/currency.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-bomb.png b/examples/quick/demos/maroon/content/gfx/dialog-bomb.png Binary files differdeleted file mode 100644 index 708d916ad7..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-bomb.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-factory.png b/examples/quick/demos/maroon/content/gfx/dialog-factory.png Binary files differdeleted file mode 100644 index d2e2a48e31..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-factory.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-melee.png b/examples/quick/demos/maroon/content/gfx/dialog-melee.png Binary files differdeleted file mode 100644 index 069d18d477..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-melee.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-pointer.png b/examples/quick/demos/maroon/content/gfx/dialog-pointer.png Binary files differdeleted file mode 100644 index 9b51a090f9..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-pointer.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog-shooter.png b/examples/quick/demos/maroon/content/gfx/dialog-shooter.png Binary files differdeleted file mode 100644 index af980caabd..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog-shooter.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/dialog.png b/examples/quick/demos/maroon/content/gfx/dialog.png Binary files differdeleted file mode 100644 index d528ba78d1..0000000000 --- a/examples/quick/demos/maroon/content/gfx/dialog.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/factory-action.png b/examples/quick/demos/maroon/content/gfx/factory-action.png Binary files differdeleted file mode 100644 index 8981678267..0000000000 --- a/examples/quick/demos/maroon/content/gfx/factory-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/factory-idle.png b/examples/quick/demos/maroon/content/gfx/factory-idle.png Binary files differdeleted file mode 100644 index a145582c8f..0000000000 --- a/examples/quick/demos/maroon/content/gfx/factory-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/factory.png b/examples/quick/demos/maroon/content/gfx/factory.png Binary files differdeleted file mode 100644 index bfb9f3fb79..0000000000 --- a/examples/quick/demos/maroon/content/gfx/factory.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/grid.png b/examples/quick/demos/maroon/content/gfx/grid.png Binary files differdeleted file mode 100644 index b59555247a..0000000000 --- a/examples/quick/demos/maroon/content/gfx/grid.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/help.png b/examples/quick/demos/maroon/content/gfx/help.png Binary files differdeleted file mode 100644 index 4654e4c69b..0000000000 --- a/examples/quick/demos/maroon/content/gfx/help.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/lifes.png b/examples/quick/demos/maroon/content/gfx/lifes.png Binary files differdeleted file mode 100644 index 135310b38c..0000000000 --- a/examples/quick/demos/maroon/content/gfx/lifes.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/logo-bubble.png b/examples/quick/demos/maroon/content/gfx/logo-bubble.png Binary files differdeleted file mode 100644 index 136151caff..0000000000 --- a/examples/quick/demos/maroon/content/gfx/logo-bubble.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/logo-fish.png b/examples/quick/demos/maroon/content/gfx/logo-fish.png Binary files differdeleted file mode 100644 index c41833a0c9..0000000000 --- a/examples/quick/demos/maroon/content/gfx/logo-fish.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/logo.png b/examples/quick/demos/maroon/content/gfx/logo.png Binary files differdeleted file mode 100644 index 787ac99ce8..0000000000 --- a/examples/quick/demos/maroon/content/gfx/logo.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/melee-action.png b/examples/quick/demos/maroon/content/gfx/melee-action.png Binary files differdeleted file mode 100644 index c53873bfcc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/melee-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/melee-idle.png b/examples/quick/demos/maroon/content/gfx/melee-idle.png Binary files differdeleted file mode 100644 index 621d9dff54..0000000000 --- a/examples/quick/demos/maroon/content/gfx/melee-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/melee.png b/examples/quick/demos/maroon/content/gfx/melee.png Binary files differdeleted file mode 100644 index ab240151f3..0000000000 --- a/examples/quick/demos/maroon/content/gfx/melee.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/mob-idle.png b/examples/quick/demos/maroon/content/gfx/mob-idle.png Binary files differdeleted file mode 100644 index dedacc7866..0000000000 --- a/examples/quick/demos/maroon/content/gfx/mob-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/mob.png b/examples/quick/demos/maroon/content/gfx/mob.png Binary files differdeleted file mode 100644 index 7569c3525a..0000000000 --- a/examples/quick/demos/maroon/content/gfx/mob.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/points.png b/examples/quick/demos/maroon/content/gfx/points.png Binary files differdeleted file mode 100644 index 1d2386dbe7..0000000000 --- a/examples/quick/demos/maroon/content/gfx/points.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/projectile-action.png b/examples/quick/demos/maroon/content/gfx/projectile-action.png Binary files differdeleted file mode 100644 index aa2e650aeb..0000000000 --- a/examples/quick/demos/maroon/content/gfx/projectile-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/projectile.png b/examples/quick/demos/maroon/content/gfx/projectile.png Binary files differdeleted file mode 100644 index c25a0c3890..0000000000 --- a/examples/quick/demos/maroon/content/gfx/projectile.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/scores.png b/examples/quick/demos/maroon/content/gfx/scores.png Binary files differdeleted file mode 100644 index af757fe64a..0000000000 --- a/examples/quick/demos/maroon/content/gfx/scores.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/shooter-action.png b/examples/quick/demos/maroon/content/gfx/shooter-action.png Binary files differdeleted file mode 100644 index 08e7e300ca..0000000000 --- a/examples/quick/demos/maroon/content/gfx/shooter-action.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/shooter-idle.png b/examples/quick/demos/maroon/content/gfx/shooter-idle.png Binary files differdeleted file mode 100644 index 663098d3b0..0000000000 --- a/examples/quick/demos/maroon/content/gfx/shooter-idle.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/shooter.png b/examples/quick/demos/maroon/content/gfx/shooter.png Binary files differdeleted file mode 100644 index d44401e055..0000000000 --- a/examples/quick/demos/maroon/content/gfx/shooter.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/sunlight.png b/examples/quick/demos/maroon/content/gfx/sunlight.png Binary files differdeleted file mode 100644 index d1c7042117..0000000000 --- a/examples/quick/demos/maroon/content/gfx/sunlight.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-1.png b/examples/quick/demos/maroon/content/gfx/text-1.png Binary files differdeleted file mode 100644 index 3ea399cc90..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-1.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-2.png b/examples/quick/demos/maroon/content/gfx/text-2.png Binary files differdeleted file mode 100644 index 934a481f3b..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-2.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-3.png b/examples/quick/demos/maroon/content/gfx/text-3.png Binary files differdeleted file mode 100644 index 47523f55b8..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-3.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-blank.png b/examples/quick/demos/maroon/content/gfx/text-blank.png Binary files differdeleted file mode 100644 index 4a687b24dc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-blank.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-gameover.png b/examples/quick/demos/maroon/content/gfx/text-gameover.png Binary files differdeleted file mode 100644 index 4f53ef0b29..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-gameover.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/text-go.png b/examples/quick/demos/maroon/content/gfx/text-go.png Binary files differdeleted file mode 100644 index bfc26f71fc..0000000000 --- a/examples/quick/demos/maroon/content/gfx/text-go.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/gfx/wave.png b/examples/quick/demos/maroon/content/gfx/wave.png Binary files differdeleted file mode 100644 index f97426c4e7..0000000000 --- a/examples/quick/demos/maroon/content/gfx/wave.png +++ /dev/null diff --git a/examples/quick/demos/maroon/content/logic.js b/examples/quick/demos/maroon/content/logic.js deleted file mode 100644 index 3830b5ad63..0000000000 --- a/examples/quick/demos/maroon/content/logic.js +++ /dev/null @@ -1,274 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -.pragma library // Shared game state -.import QtQuick 2.0 as QQ - -// Game Stuff -var gameState // Local reference -function getGameState() { return gameState; } - -var towerData = [ // Name and cost, stats are in the delegate per instance - { "name": "Melee", "cost": 20 }, - { "name": "Ranged", "cost": 50 }, - { "name": "Bomb", "cost": 75 }, - { "name": "Factory", "cost": 25 } -] - -var waveBaseData = [300, 290, 280, 270, 220, 180, 160, 80, 80, 80, 30, 30, 30, 30]; -var waveData = []; - -var towerComponents = new Array(towerData.length); -var mobComponent = Qt.createComponent("mobs/MobBase.qml"); - -function endGame() -{ - gameState.gameRunning = false; - gameState.gameOver = true; - for (var i = 0; i < gameState.cols; i++) { - for (var j = 0; j < gameState.rows; j++) { - if (gameState.towers[towerIdx(i, j)]) { - gameState.towers[towerIdx(i, j)].destroy(); - gameState.towers[towerIdx(i, j)] = null; - } - } - for (var j in gameState.mobs[i]) - gameState.mobs[i][j].destroy(); - gameState.mobs[i].splice(0,gameState.mobs[i].length); //Leaves queue reusable - } -} - -function startGame(gameCanvas) -{ - waveData = new Array(); - for (var i in waveBaseData) - waveData[i] = waveBaseData[i]; - gameState.freshState(); - for (var i = 0; i < gameCanvas.cols; i++) { - for (var j = 0; j < gameCanvas.rows; j++) - gameState.towers[towerIdx(i, j)] = null; - gameState.mobs[i] = new Array(); - } - gameState.towers[towerIdx(0, 0)] = newTower(3, 0, 0);//Start with a starfish in the corner - gameState.gameRunning = true; - gameState.gameOver = false; -} - -function newGameState(gameCanvas) -{ - for (var i = 0; i < towerComponents.length; i++) { - towerComponents[i] = Qt.createComponent("towers/" + towerData[i].name + ".qml"); - if (towerComponents[i].status == QQ.Component.Error) { - gameCanvas.errored = true; - gameCanvas.errorString += "Loading Tower " + towerData[i].name + "\n" + (towerComponents[i].errorString()); - console.log(towerComponents[i].errorString()); - } - } - gameState = gameCanvas; - gameState.freshState(); - gameState.towers = new Array(gameCanvas.rows * gameCanvas.cols); - gameState.mobs = new Array(gameCanvas.cols); - return gameState; -} - -function row(y) -{ - return Math.floor(y / gameState.squareSize); -} - -function col(x) -{ - return Math.floor(x / gameState.squareSize); -} - -function towerIdx(x, y) -{ - return y + (x * gameState.rows); -} - -function newMob(col) -{ - var ret = mobComponent.createObject(gameState.canvas, - { "col" : col, - "speed" : (Math.min(2.0, 0.10 * (gameState.waveNumber + 1))), - "y" : gameState.canvas.height }); - gameState.mobs[col].push(ret); - return ret; -} - -function newTower(type, row, col) -{ - var ret = towerComponents[type].createObject(gameState.canvas); - ret.row = row; - ret.col = col; - ret.fireCounter = ret.rof; - ret.spawn(); - return ret; -} - -function buildTower(type, x, y) -{ - if (gameState.towers[towerIdx(x,y)] != null) { - if (type <= 0) { - gameState.towers[towerIdx(x,y)].sell(); - gameState.towers[towerIdx(x,y)] = null; - } - } else { - if (gameState.coins < towerData[type - 1].cost) - return; - gameState.towers[towerIdx(x, y)] = newTower(type - 1, y, x); - gameState.coins -= towerData[type - 1].cost; - } -} - -function killMob(col, mob) -{ - if (!mob) - return; - var idx = gameState.mobs[col].indexOf(mob); - if (idx == -1 || !mob.hp) - return; - mob.hp = 0; - mob.die(); - gameState.mobs[col].splice(idx,1); -} - -function killTower(row, col) -{ - var tower = gameState.towers[towerIdx(col, row)]; - if (!tower) - return; - tower.hp = 0; - tower.die(); - gameState.towers[towerIdx(col, row)] = null; -} - -function tick() -{ - if (!gameState.gameRunning) - return; - - // Spawn - gameState.waveProgress += 1; - var i = gameState.waveProgress; - var j = 0; - while (i > 0 && j < waveData.length) - i -= waveData[j++]; - if ( i == 0 ) // Spawn a mob - newMob(Math.floor(Math.random() * gameState.cols)); - if ( j == waveData.length ) { // Next Wave - gameState.waveNumber += 1; - gameState.waveProgress = 0; - var waveModifier = 10; // Constant governing how much faster the next wave is to spawn (not fish speed) - for (var k in waveData ) // Slightly faster - if (waveData[k] > waveModifier) - waveData[k] -= waveModifier; - } - - // Towers Attack - for (var j in gameState.towers) { - var tower = gameState.towers[j]; - if (tower == null) - continue; - if (tower.fireCounter > 0) { - tower.fireCounter -= 1; - continue; - } - var column = tower.col; - for (var k in gameState.mobs[column]) { - var conflict = gameState.mobs[column][k]; - if (conflict.y <= gameState.canvas.height && conflict.y + conflict.height > tower.y - && conflict.y - ((tower.row + 1) * gameState.squareSize) < gameState.squareSize * tower.range) { // In Range - tower.fire(); - tower.fireCounter = tower.rof; - conflict.hit(tower.damage); - } - } - - // Income - if (tower.income) { - gameState.coins += tower.income; - tower.fire(); - tower.fireCounter = tower.rof; - } - } - - // Mobs move - for (var i = 0; i < gameState.cols; i++) { - for (var j = 0; j < gameState.mobs[i].length; j++) { - var mob = gameState.mobs[i][j]; - var newPos = gameState.mobs[i][j].y - gameState.mobs[i][j].speed; - if (newPos < 0) { - gameState.lives -= 1; - killMob(i, mob); - if (gameState.lives <= 0) - endGame(); - continue; - } - var conflict = gameState.towers[towerIdx(i, row(newPos))]; - if (conflict != null) { - if (mob.y < conflict.y + gameState.squareSize) - gameState.mobs[i][j].y += gameState.mobs[i][j].speed * 10; // Moved inside tower, now hurry back out - if (mob.fireCounter > 0) { - mob.fireCounter--; - } else { - gameState.mobs[i][j].fire(); - conflict.hp -= mob.damage; - if (conflict.hp <= 0) - killTower(conflict.row, conflict.col); - mob.fireCounter = mob.rof; - } - } else { - gameState.mobs[i][j].y = newPos; - } - } - } - -} diff --git a/examples/quick/demos/maroon/content/mobs/MobBase.qml b/examples/quick/demos/maroon/content/mobs/MobBase.qml deleted file mode 100644 index 584623fa77..0000000000 --- a/examples/quick/demos/maroon/content/mobs/MobBase.qml +++ /dev/null @@ -1,272 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -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() { } - - 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); - } - - function inked() { - if (hp > 0) - ink.jumpTo("dirty"); - } - - function hit(dmg) { - hp -= dmg; - - if (hp <= 0) - Logic.killMob(col, container); - } - - Component.onCompleted: spawnSound.play() - - SoundEffect { - id: spawnSound - source: "../audio/catch.wav" - } - SoundEffect { - id: killedSound - source: "../audio/catch-action.wav" - } - - SpriteSequence { - id: fishSprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - 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 } - } - - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - - NumberAnimation on x { - id: fishSwim - running: false - property bool goingLeft: fishSprite.currentSprite == "right" - to: goingLeft ? -360 : 360 - duration: 300 - } - } - - SpriteSequence { - id: bubble - width: 64 - height: 64 - scale: 0.4 + (0.2 * hp) - interpolate: false - goalSprite: "" - - Behavior on scale { - NumberAnimation { duration: 150; easing.type: Easing.OutBack } - } - - Sprite { - name: "big" - source: "../gfx/catch.png" - frameCount: 1 - to: { "burst" : 0 } - } - - Sprite { - name: "burst" - source: "../gfx/catch-action.png" - frameCount: 3 - frameX: 64 - frameDuration: 200 - } - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - 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 } - } - 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 } - } - } - - SpriteSequence { - id: ink - width: 64 - height: 64 - scale: bubble.scale - goalSprite: "" - - Sprite { - name: "clean" - source: "../gfx/projectile-action.png" - frameCount: 1 - frameX: 0 - frameWidth: 64 - frameHeight: 64 - } - Sprite { - name: "dirty" - source: "../gfx/projectile-action.png" - frameCount: 3 - frameX: 64 - frameWidth: 64 - frameHeight: 64 - frameDuration: 150 - to: {"clean":1} - } - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - 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 } - } - 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 } - } - - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x - 5; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x - 5; to: x; duration: 900; easing.type: Easing.InOutQuad } - } -} - diff --git a/examples/quick/demos/maroon/content/towers/Bomb.qml b/examples/quick/demos/maroon/content/towers/Bomb.qml deleted file mode 100644 index e33d71d2e0..0000000000 --- a/examples/quick/demos/maroon/content/towers/Bomb.qml +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -TowerBase { - id: container - hp: 10 - range: 0.4 - rof: 10 - property real detonationRange: 2.5 - - function fire() { - sound.play() - sprite.jumpTo("shoot") - animDelay.start() - } - - function finishFire() { - var sCol = Math.max(0, col - 1) - var eCol = Math.min(Logic.gameState.cols - 1, col + 1) - var killList = new Array() - for (var i = sCol; i <= eCol; i++) { - for (var j = 0; j < Logic.gameState.mobs[i].length; j++) - if (Math.abs(Logic.gameState.mobs[i][j].y - container.y) < Logic.gameState.squareSize * detonationRange) - killList.push(Logic.gameState.mobs[i][j]) - while (killList.length > 0) - Logic.killMob(i, killList.pop()) - } - Logic.killTower(row, col); - } - - Timer { - id: animDelay - running: false - interval: shootState.frameCount * shootState.frameDuration - onTriggered: finishFire() - } - - function die() - { - destroy() // No blink, because we usually meant to die - } - - SoundEffect { - id: sound - source: "../audio/bomb-action.wav" - } - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/bomb-idle.png" - frameCount: 4 - frameDuration: 800 - } - - Sprite { - id: shootState - name: "shoot" - source: "../gfx/bomb-action.png" - frameCount: 6 - frameDuration: 155 - to: { "dying" : 1 } // So that if it takes a frame to clean up, it is on the last frame of the explosion - } - - Sprite { - name: "dying" - source: "../gfx/bomb-action.png" - frameCount: 1 - frameX: 64 * 5 - frameWidth: 64 - frameHeight: 64 - frameDuration: 155 - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } - } - } -} diff --git a/examples/quick/demos/maroon/content/towers/Factory.qml b/examples/quick/demos/maroon/content/towers/Factory.qml deleted file mode 100644 index 6b688e051a..0000000000 --- a/examples/quick/demos/maroon/content/towers/Factory.qml +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -TowerBase { - id: container - rof: 160 - income: 5 - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/factory-idle.png" - frameCount: 4 - frameDuration: 200 - } - - Sprite { - name: "action" - source: "../gfx/factory-action.png" - frameCount: 4 - frameDuration: 90 - to: { "idle" : 1 } - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } - } - } - - SoundEffect { - id: actionSound - source: "../audio/factory-action.wav" - } - - function fire() { - actionSound.play() - sprite.jumpTo("action") - coinLaunch.start() - } - - function spawn() { - coin.target = Logic.gameState.mapToItem(container, 240, -32) - } - - Image { - id: coin - property var target: { "x" : 0, "y" : 0 } - source: "../gfx/currency.png" - visible: false - } - - SequentialAnimation { - id: coinLaunch - PropertyAction { target: coin; property: "visible"; value: true } - ParallelAnimation { - NumberAnimation { target: coin; property: "x"; from: 16; to: coin.target.x } - NumberAnimation { target: coin; property: "y"; from: 16; to: coin.target.y } - } - PropertyAction { target: coin; property: "visible"; value: false } - } -} diff --git a/examples/quick/demos/maroon/content/towers/Melee.qml b/examples/quick/demos/maroon/content/towers/Melee.qml deleted file mode 100644 index f83bd4c525..0000000000 --- a/examples/quick/demos/maroon/content/towers/Melee.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import ".." - -TowerBase { - hp: 4 - range: 0.1 - damage: 1 - rof: 40 - income: 0 - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameDuration: 250 - } - - Sprite { - name: "shoot" - source: "../gfx/melee-action.png" - frameCount: 2 - frameDuration: 200 - to: { "idle" : 1 } - } - } - - function fire() { - shootSound.play() - sprite.jumpTo("shoot") - } - - SoundEffect { - id: shootSound - source: "../audio/melee-action.wav" - } -} diff --git a/examples/quick/demos/maroon/content/towers/Ranged.qml b/examples/quick/demos/maroon/content/towers/Ranged.qml deleted file mode 100644 index 2c1f5d1343..0000000000 --- a/examples/quick/demos/maroon/content/towers/Ranged.qml +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../logic.js" as Logic -import ".." - -TowerBase { - id: container - hp: 2 - range: 6 - damage: 0 // By projectile - rof: 40 - income: 0 - property var targetMob - property real realDamage: 1 - function fire() { - proj.x = 32 - proj.width / 2 - proj.y = 0 - targetMob = Logic.gameState.mobs[col][0] - projAnim.to = targetMob.y - container.y -10 - projAnim.start() - shootSound.play() - sprite.jumpTo("shoot") - } - - Image { - id: proj - y: 1000 - SequentialAnimation on y { - id: projAnim - running: false - property real to: 1000 - SmoothedAnimation { - to: projAnim.to - velocity: 400 - } - ScriptAction { - script: { - if (targetMob && targetMob.hit) { - targetMob.hit(realDamage) - targetMob.inked() - projSound.play() - } - } - } - PropertyAction { - value: 1000; - } - } - source: "../gfx/projectile.png" - } - - SoundEffect { - id: shootSound - source: "../audio/shooter-action.wav" - } - SoundEffect { - id: projSound - source: "../audio/projectile-action.wav" - } - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/shooter-idle.png" - frameCount: 4 - frameDuration: 250 - } - - Sprite { - name: "shoot" - source: "../gfx/shooter-action.png" - frameCount: 5 - frameDuration: 90 - to: { "idle" : 1 } - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x - 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - } -} diff --git a/examples/quick/demos/maroon/content/towers/TowerBase.qml b/examples/quick/demos/maroon/content/towers/TowerBase.qml deleted file mode 100644 index be37d732e4..0000000000 --- a/examples/quick/demos/maroon/content/towers/TowerBase.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - property real hp: 1 - property real range: 0 - property real damage: 0 - property int rof: 100 - property int fireCounter: 0 - property int income: 0 - property int row: 0 - property int col: 0 - - width: parent ? parent.squareSize : 0 - height: parent ? parent.squareSize : 0 - //This is how it is placed on the gameboard, do not modify/animate the X/Y/Z of a TowerBase please - x: col * width - y: row * height - z: 1000 - - function fire() { } - function spawn() { } //After all game properties are set - function die() { stdDeath.start(); destroy(1000); } - function sell() { destroy(); } - - SequentialAnimation on opacity { - id: stdDeath - running: false - loops: 2 - NumberAnimation { from: 1; to: 0; } - NumberAnimation { from: 0; to: 1; } - } -} diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png Binary files differdeleted file mode 100644 index 6d41179c23..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-1.png +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png Binary files differdeleted file mode 100644 index c8f37486f6..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-2.png +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg Binary files differdeleted file mode 100644 index a83e282d5f..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-3.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg Binary files differdeleted file mode 100644 index 8a6063b7c7..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-4.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg Binary files differdeleted file mode 100644 index e3e4a2ec89..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-5.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg b/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg Binary files differdeleted file mode 100644 index ad6b4bf156..0000000000 --- a/examples/quick/demos/maroon/doc/images/qtquick-demo-maroon-med-6.jpg +++ /dev/null diff --git a/examples/quick/demos/maroon/doc/src/maroon.qdoc b/examples/quick/demos/maroon/doc/src/maroon.qdoc deleted file mode 100644 index e6f0a25238..0000000000 --- a/examples/quick/demos/maroon/doc/src/maroon.qdoc +++ /dev/null @@ -1,889 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - Maroon in Trouble - \ingroup qtquickdemos - \example demos/maroon - \brief 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. - - \image qtquick-demo-maroon-med-2.png - - \e{Maroon in Trouble} demonstrates QML features that are useful when - developing games: - - \list - \li Using custom QML types to create different screens for - different stages of the game. - \li Using the \l Item and \l Image types to construct a game background. - \li Using the SequentialAnimation, NumberAnimation, ParticleSystem, - \l Emitter, and \l Wander types to animate background objects. - \li Using the \l Timer and \l Repeater types to display a countdown - sequence before starting the game. - \li Using a custom QML type with custom properties to construct a game - board. - \li Using the SpriteSequence and \l Sprite types to add animated objects - to the game board. - \li Using a custom QML type that uses the \l Image type with some custom - properties to add a menu where the players can buy objects. - \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 Using the \l State type with JavaScript functions to manage game - states. - \li Using the \l SoundEffect type to play individual sound effects - depending on the object type and the action applied to the object. - \li Using signal handlers to specify keyboard shortcuts for some game - actions. - \li Using resource files to package game resources for deployment and - delivery. - \endlist - - \include examples-run.qdocinc - - \section1 Adding Screens - - 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: - - \list - \li NewGameScreen.qml - \li GameCanvas.qml - \li GameOverScreen.qml - \endlist - - To use the custom types, we add an import statement to the main QML file, - maroon.qml that imports the folder called \c content where the types are - located: - - \quotefromfile demos/maroon/maroon.qml - \skipto content - \printuntil " - - 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 \l{Image} type to create a New Game - button that the players can press to start a new game. - - \image qtquick-demo-maroon-med-1.png - - Tapping the button initiates a countdown timer that triggers the creation - of the game canvas by using the GameCanvas type. Another \l{Timer} 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. - - \image qtquick-demo-maroon-med-2.png - - 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. - - \image qtquick-demo-maroon-med-3.jpg - - The screens are all created on the same background and use some of the same - images and animations. - - \section1 Constructing the Background - - In the maroon.qml file, we use an \l{Item} type with the id \c root and a - fixed width and height to create a main window for the game: - - \skipto Item - \printuntil passedSplash - - We declare two custom properties for the root item, \c gameState and - \c passedSplash that we will use later to manage game states. - - We use an \l{Image} item to display the game background image: - - \printuntil anchors.bottom - - 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. - - We use the \c anchors.bottom property to anchor the background image to the - bottom of the \l{Column} layout that we use to position the screens: - - \skipto Column - \printuntil GameOverScreen - - We set a negative value for the \c y 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 \c height property. - - Within the column layout, we use an \l{Item} type to add objects to the - background. Within the item, we use \l{Row} layout objects to position - \l{Image} objects that display waves on the game canvas and the game over - screen: - - \printuntil } - \printuntil } - \dots - \skipto Row - \printuntil } - \printuntil } - - The second row of waves is positioned on the y axis with a slight offset to - the first row. We also use the \c opacity property to make the waves appear - lighter in color than the first two waves, which gives the background some - depth. - - We use \l{Image} objects to also display sunlight on the new game screen and - on the game canvas: - - \skipto Image - \printuntil anchors - \dots - \skipto Image - \printuntil anchors - - We set the \c opacity property of the images to \c 0.02 and \c 0.04 to give - some depth to the rays of sunshine. We use the \c y property to position the - images at fixed locations on the y axis and the - \c {anchors.horizontalCenter} property to center them horizontally in - relation to their parent. - - We use an \l {Image} type to display an image that adds a deepening shadow - to the background: - - \skipto Image - \printuntil } - - We set the \c opacity property of the image to \c 0.5 to make the background - visible behind the shadow. - - To make the background more interesting, we animate some of the objects we - added to it. - - \section1 Animating Background Objects - - We use NumberAnimation to move the waves horizontally across the screen in - opposite directions and SequentialAnimation with NumberAnimation to move - them up and down. - - We apply the number animation to the \c x property of \c wave as a property - value source to animate the x value from its current value to the - \c -(wave.width), over 16 seconds. We set the \c loops property to - \c {Animation.Infinite} to repeat the animation indefinitely: - - \quotefromfile demos/maroon/maroon.qml - \skipto wave.width - \printuntil } - - We apply the sequential animation to the \c y 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: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - We use the easing curve of the type \c {Easing.InOutQuad} for a quintic - (t^5) function to accelerate the motion until halfway and then decelerate - it. - - We use sequential animation and number animation to animate \c wave2 - similarly to \c wave, but in the opposite direction: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - We use sequential animation to rotate the rays of sunlight in degrees - clockwise around an origin point that we set to \c {Item.Top} in the - \c transformOrigin property. The animation is repeated indefinitely: - - \skipto transformOrigin - \printuntil to: -10 - \printuntil } - - We use one number animation to rotate the image from \c -10 degrees to - \c 10 degrees over 8 seconds and another to subsequently rotate it from - \c 10 degrees to \c -10 degrees over the same duration. - - We use the easing curve of the type \c {Easing.InOutSine} for a sinusoidal - (sin(t)) function to accelerate the motion until halfway and then decelerate - it. - - We use sequential animation and number animation to animate another - sunlight.png image similarly, but in the opposite direction: - - \skipto transformOrigin - \printuntil to: 10 - \printuntil } - - For examples of using SequentialAnimation and NumberAnimation on the \c x - and \c y properties and the \c width and \c height properties, see - NewGameScreen.qml. - - \section1 Emitting Particles - - 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. - - To use the ParticleSystem type, we must import \l{Qt Quick Particles QML Types}: - - \quotefromfile demos/maroon/maroon.qml - \skipto Particles - \printuntil 0 - - To have the particles appear on the game background, we place the - ParticleSystem type within the \l{Image} type that displays the game - background: - - \skipto Image - \printuntil anchors.fill - - In the ParticleSystem, we use an \l{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: - - \skipto Emitter - \printuntil sizeVariation - \printuntil } - - The \c acceleration 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. - - The \c size property sets the base size of the particles at the beginning of - their life to 24 pixels and the \c sizeVariation property randomly increases - or decreases the particle size by up to 16 pixels, so that we get bubbles in - different sizes. - - As emitters have no visualization, we use the ImageParticle type to render - the catch.png image at the particle location: - - \quotefromfile demos/maroon/maroon.qml - \skipto ImageParticle - \printuntil } - - A \l{Wander} type applies a random trajectory to the particles, so that the - bubbles follow random routes from the bottom to the top. - - \printuntil } - - 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. - - \section1 Using Timers - - \image qtquick-demo-maroon-med-4.jpg - - In maroon.qml, we use the \l{Timer} type with a \l{Repeater} type to display - a countdown sequence before using another timer to start a new game. Both - timers are started simultaneously in the \c "gameOn" state, that is when the - players tap the New Game button and \c passedSplash is \c true. This is - explained in more detail in \l{Managing Game States}. - - We use the \c countdownTimer to display the countdown sequence: - - \skipto Timer - \printuntil } - - The \c onTriggered signal handler is called when the timer is triggered to - increment the value of the \c countdown custom property. - - We set the \c repeat property to \c true to specify that the timer is - triggered at the interval of 1 second as long as the value of \c countdown - is less than 5. - - The \c countdown property is defined in the root item with an initial value - of \c 10, so that \c countdownTimer is not running by default: - - \skipto countdown: - \printuntil 10 - - Each time the timer is triggered, an image from the countdown sequence is - displayed. We use a \l{Repeater} type to instantiate the \l{Image} delegate - in the context of the repeater's parent, \c canvasArea item, seeded with - data from the \c model: - - \quotefromfile demos/maroon/maroon.qml - \skipto Repeater - \printuntil scale - \printuntil } - \printuntil } - \printuntil } - \printuntil } - - We scale the images from \c 0.0 to \c 1.0 and use the \c visible 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. - - By animating the changes in the \c opacity and \c scale properties using a - \l Behavior type, we achieve a countdown sequence where numbers zoom in - towards the players. - - \section1 Constructing the Game Board - - To construct the game board, we use the GameCanvas custom type that is - defined in GameCanvas.qml. - - 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, \c canvasArea: - - \quotefromfile demos/maroon/maroon.qml - \skipto GameCanvas - \printuntil } - - We set the \c focus property to \c true to give \c canvas active focus on - startup. - - In GameCanvas.qml, we use an \l Item type and define custom properties for - it to create a grid of equally sized squares divided to 4 columns on 6 rows: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Item - \printuntil canvas - - We use the custom properties to set the \c width and \c height of the - \c grid item as the amount of columns and rows multiplied by square size: - - \skipto width - \printuntil height - - We use an \l{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: - - \skipuntil endGame - \skipto Image - \printuntil bottomMargin - \printuntil } - - We declare the \c goAway() private function to disable the mouse area and - make the image fully transparent and a \c comeBack() function to enable the - mouse area and make the button fully opaque. We use a \l {Behavior} type on - the \c opacity property to apply the default number animation when the value - of \c opacity changes. - - When the players tap the help button, the \c onClicked signal handler is - called to hide the help button by setting the \c {helpButton.visible} - property to \c false and to show the help image by setting the - \c {helpImage.visible} property to \c false. - - \image qtquick-demo-maroon-med-6.jpg - - We use anchoring to position the help button at the bottom center of the - game canvas. - - We use another \l{Image} type to display the help image: - - \printuntil } - \printuntil } - - To hide the help image when the players tap it, the \c onClicked signal - handler within the MouseArea type is called to set the \c{helpImage.visible} - property to \c true. - - To ensure that the images are placed on top when they are visible, we set - a high value for their \c z property. - - 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. - - \section1 Animating Objects on the Game Board - - We use sprite animation to animate objects on the game board. The Qt Quick - \l{Sprite Animations}{sprite engine} is a stochastic state machine combined - with the ability to chop up images containing multiple frames of an - animation. - - \section2 Spawning Fish - - We use a \l{Timer} element with the \c tick() function in GameCanvas.qml to - spawn mobs of fish in waves at an increasing rate, starting at 16 - milliseconds: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Timer - \printuntil } - - We use the MobBase custom type that is defined in MobBase.qml to - animate mobs of fish that swim inside bubbles. We use an \l{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: - - \quotefromfile demos/maroon/content/mobs/MobBase.qml - \skipto Item - \printuntil } - \dots - - We use a SpriteSequence type to animate the fish: - - \skipto SpriteSequence - \printuntil goalSprite - - The SpriteSequence type renders and controls a list of animations - defined by \l{Sprite} types: - - \skipto Sprite { - \printuntil name: "right" - \printuntil } - \printuntil } - - In the \c fishSprite sprite sequence, each sprite defines one frame within - the mob-idle.png file, which shows a fish facing right, front, and left: - - \image ../../content/gfx/mob-idle.png - - We use the \c frameWidth, \c frameHeight, and \c frameX properties to - determine that the first 64x64-pixel square of the image is framed in the - \c "left" sprite, the second in the \c "front" sprite, and the third in the - \c "right" sprite. For each sprite, the \c frameCount property is set to - \c 1 to specify that the sprite contains one frame. - - We use the \c frameDuration and \c frameDurationVariation properties to - specify that the duration of an animation can vary from \c 400 to \c 1200 - milliseconds. - - The \c to property specifies that the sprites have weighted transitions to - other sprites. The \c "left" and \c "right" sprites always transfer to the - \c "front" sprite. When the \c "front" animation finishes, the sprite engine - chooses \c "left" or \c "right" randomly, but at roughly equal proportions, - because they both have the weight \c 1. - - 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 \c jumpTo method with the JavaScript \c {Math.random()} method in the - \c die() private function to randomly jump to the \c "left" or \c "right" - sprite: - - \quotefromfile demos/maroon/content/mobs/MobBase.qml - \skipto die() - \printuntil } - - We then use the \c start() function to run a NumberAnimation that applies a - number animation to the x value from its current value to \c -360 or \c 360, - depending on whether the \c goingLeft custom property is \c true, in 300 - milliseconds: - - \skipto NumberAnimation - \printuntil } - - \section2 Bursting Bubbles - - 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 \c scale property to - decrease by \c 0.2 each time the custom \c hp property changes: - - \skipto SpriteSequence - \printuntil goalSprite - - We use a \l{Behavior} type to apply a NumberAnimation when the value of - \c scale changes. We use the \c{Easing.OutBack} 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: - - \skipto Behavior - \printuntil } - \printuntil } - - The SpriteSequence consist of two sprites that display different images. The - first sprite, \c "big", uses the catch.png image to display an empty bubble: - - \skipto Sprite - \printuntil } - \printuntil } - - We set the \c to property to \c "burst" with the weight \c 0 to make the - second sprite, \c "burst", a valid goal for the \c jumpTo method that we use - in the \c die() private function to jump directly to the \c "burst" sprite - without playing the first sprite. - - In the \c "burst" sprite, we set the \c frameCount property to \c 3 and the - \c frameX property to \c 64 to specify that the animation starts at pixel - location 64 and loads each frame for the duration of 200 milliseconds. - - \skipto Sprite - \printuntil } - - 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 \c width property - with two number animations to first increase the bubble width from - \c{* 1} to \c{* 1.1} over 800 milliseconds and then bring it back over 1 - second: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - Similarly, we increase the bubble height from \c{* 1} to \c{* 1.15} over - 1200 milliseconds and then bring it back over 1 second: - - \skipto SequentialAnimation - \printuntil } - \printuntil } - \printuntil } - - 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 \c towers directory. - - \section1 Adding Dialogs - - \image qtquick-demo-maroon-med-5.jpg - - In GameCanvas.qml, we use an \l{Image} type with some custom properties to - create a menu where the players can buy tower objects: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Image - \printuntil towerExists - - We set the \c visible property to \c false to hide the menu by default. The - \c z property is set to 1500 to ensure that the menu is displayed in front - of all other items when it is visible. - - We use a MouseArea type to open or close the menu when players tap on the - canvas: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto MouseArea - \printuntil } - \printuntil } - - We set the \c anchors.fill property to \c parent to allow the players to tap - anywhere on the game canvas. We use a condition in the \c onClicked - signal handler to call the \c {finish()} function if the menu is visible - and the \c {open()} function otherwise. - - The \c {finish()} function hides the menu by setting the \c shown custom - property to \c false: - - \skipto finish - \printuntil } - - The \c {open()} function displays the menu at the x and y position of the - mouse pointer: - - \printuntil } - - If \c gameRunning is \c true, we call the JavaScript \c row() function to - calculate the value of the \c targetRow custom property and the \c col() - function to calculate the value of the \c targetCol custom property. If - the value of \c targetRow equals \c 0, the y position is set to one square - above the mouse pointer. Otherwise, it is set to one square below the mouse - pointer. - - We use the \c towerIdx() function to set the value of the \c towerExists - custom property. - - We set the \c shown custom property to \c true to show the menu and call the - \c {helpButton.goAway()} function to hide the help button when the menu - opens. - - We use states and transitions to display the menu when the \c shown - property is \c true and the \c gameOver property is \c false: - - \printuntil OutElastic - \printuntil } - - To set the visibility of the menu to \c "visible" 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 \c scale property from \c 0.9 to \c 1 and the - value of \c opacity property from \c 0.7 to \c 1, over 500 milliseconds. - We use the \c {Easing.outElastic} easing type for an elastic (exponentially - decaying sine wave) function easing curve that decelerates from zero - velocity. - - 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 \l{Row} layout - in front of the menu background image, dialog.png: - - \printuntil dialog-factory.png - \printuntil } - \printuntil } - \printuntil } - - For each build button, we set the values of \c towerType and \c index custom - properties that we define in BuildButton.qml. - - We use the \c canBuild custom property to prevent players from adding tower - objects in locations where tower objects already exist. - - We use the \c source property to display the image for the tower type. - - The \c onClicked signal handler is called to execute the \c finish() - function that closes the menu when the players tap an enabled build button. - - Build buttons are enabled when the players have enough coins to buy the - tower objects. We use an \l {Image} type in BuildButton.qml to display - images on the buttons: - - \quotefromfile demos/maroon/content/BuildButton.qml - \skipto Image - \printuntil } - - We use the \c opacity property to make the buttons appear enabled. If - \c canBuild is \c true and the value of the \c gameCanvas.coins property - is larger than or equal to the cost of a tower object, the images are fully - opaque, otherwise their opacity is set to \c 0.4. - - We use a \l{Text} type to display the cost of each tower item, as specified - by the \c towerData variable, depending on \c towerType: - - \skipto Text - \printuntil } - - To display a pointer on the screen at the position where the tower object - will be added, we use the \l {Image} type. We use the \c visible property - to determine whether the dialog-pointer.png image should be positioned below - or above the menu. When the value of the \c col property equals the \c index - and the value or the \c row property is not \c 0, we anchor the image to the - bottom of its parent, BuildButton. - - When the value or the \c row property is \c 0, we anchor the image to the - top of BuildButton to position the pointer above the menu and use the - \c rotation property to rotate it by 180 degrees, so that it points upwards: - - \skipto Image - \printuntil } - \printuntil } - - \section1 Keeping Track of Game Statistics - - To keep track of the game statistics, we use the InfoBar custom type (that - is defined in InfoBar.qml) in maroon.qml: - - \quotefromfile demos/maroon/maroon.qml - \skipto InfoBar - \printuntil } - - We use the \c {anchors.bottom} and \c {anchors.bottomMargin} properties to - position the info bar at 6 points from the top of the game canvas. We bind - the \c width property of the info bar to that of its parent. - - In InfoBar.qml, we use an \l{Item} type to create the info bar. Within it, - we use a \l{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. - - We use the \c anchors property to position the rows in relationship to their - parent and to each other. In the first \l{Row} object, we use the - \c {anchors.left} and \c {anchors.leftMargin} properties to position the - heart icons at 10 points from the left border of the parent item: - - \quotefromfile demos/maroon/content/InfoBar.qml - \skipto Item - \printuntil } - \printuntil } - \printuntil } - - We use a \l{Repeater} type with a \c model and a \c delegate to display as - many hearts as the players have lives left. We use the \c spacing property - to leave 5 pixels between the displayed icons. - - In the second \l{Row} object, we use the \c {anchors.right} and - \c {anchors.rightMargin} properties to position the number of fish saved at - 20 points left of the third \l{Row} object that displays the number of coins - available (and has the id \c points): - - \skipto Row - \printuntil /^\}/ - - In these objects, we set spacing to 5 pixels to separate the icons from the - numbers that we display by using a \l{Text} type. - - In GameCanvas.qml, we define custom properties to hold the game statistics: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto score - \printuntil lives - - We declare the \c freshState() function to set the initial game statistics - when a new game starts: - - \skipto freshState() - \printuntil } - - We use the \c {Logic.gameState.score} variable in the \c die() function - that we declare in MobBase.qml to increase the score by one when the players - set a fish free: - - \quotefromfile demos/maroon/content/mobs/MobBase.qml - \skipto score - \printuntil ; - - \section1 Managing Game States - - In maroon.qml, we use a \l{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 \c Logic namespace in that file: - - \quotefromfile demos/maroon/maroon.qml - \skipto logic.js - \printuntil Logic - - 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: - - \skipto newGameState - \printuntil ; - - In NewGameScreen.qml we use the \c onClicked signal handler to emit the - \c startButtonClicked() signal when the players tap the New Game button: - - \quotefromfile demos/maroon/content/NewGameScreen.qml - \skipto to: 150 - \skipto Image - \printuntil } - - In maroon.qml, we use the \c onStartButtonClicked signal handler to set the - \c passedSplash property of the \c root item to \c true: - - \quotefromfile demos/maroon/maroon.qml - \skipto NewGameScreen - \printuntil } - - We then use the \c passedSplash property in the \c when property of the - \c gameOn state to trigger the \c gameStarter timer: - - \skipto State { - \printuntil gameStarter - \printuntil } - - We also switch to the \c "gameOn" state and move to the y position - \c {-(height - 960)} to display the game canvas. - - In the \c gameStarter \l{Timer} object we use the \c onTriggered signal - handler to call the \c startGame() function that starts a new game: - - \quotefromfile demos/maroon/maroon.qml - \skipto property int - \skipto Timer - \printuntil } - - The game continues until \c gameState.gameOver is set to \c true and - \c gameState.gameRunning is set to \c false by calling the \c endGame() - function when the value of the \c gameState.lives property becomes less - than or equal to \c 0. - - In GameOverScreen.qml, we use a MouseArea type and an \c onClicked signal - handler within an \l{Image} type to return to the game canvas when the - players tap the New Game button: - - \quotefromfile demos/maroon/content/GameOverScreen.qml - \skipto opacity: 0.5 - \skipto Image - \printuntil } - \printuntil } - - The \c onClicked signal handler triggers a state change in maroon.qml to - display the game canvas: - - \quotefromfile demos/maroon/maroon.qml - \skipto target: gameStarter - \skipto State - \printuntil } - \printuntil } - - \section1 Playing Sound Effects - - The app can play sound effects if the \l{Qt Multimedia} module is installed. - In the SoundEffect.qml file, we proxy a SoundEffect type: - - \quotefromfile demos/maroon/content/SoundEffect.qml - \skipto Item - \printuntil } - \printuntil } - - We add the \c qtHaveModule() qmake command to the app .pro file, maroon.pro, - to check whether the \l{Qt Multimedia} module is present: - - \quotefromfile demos/maroon/maroon.pro - \skipto QT - \printuntil multimedia - - 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: - - \quotefromfile demos/maroon/content/towers/Bomb.qml - \skipto SoundEffect - \printuntil } - - To play the sound effect when a bomb explodes, we call the \c sound.play() - function that we declare as a member of the private \c fire() function - within the TowerBase custom type: - - \quotefromfile demos/maroon/content/towers/Bomb.qml - \skipto fire() - \printuntil } - - For more examples of playing sound effects, see the QML files in the - \c towers directory and MobBase.qml. - - \section1 Adding Keyboard Shortcuts - - 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 \c {Keys.onPressed} - signal handler to specify keyboard shortcuts. You can press Shift+Up to - increment the values of the \c coins property to add coins, Shift+Left to - increment the value of \c lives, Shift+Down to increment the value of the - \c waveProgress property to spawn mobs of fish faster, and Shift+Right to - call the \c endGame() function to quit the game: - - \quotefromfile demos/maroon/content/GameCanvas.qml - \skipto Keys - \printuntil } - - \section1 Packaging Resources for Deployment - - 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 \l{The Qt Resource System}. - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/maroon/main.cpp b/examples/quick/demos/maroon/main.cpp deleted file mode 100644 index f6590fc32e..0000000000 --- a/examples/quick/demos/maroon/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/maroon/maroon) diff --git a/examples/quick/demos/maroon/maroon.pro b/examples/quick/demos/maroon/maroon.pro deleted file mode 100644 index ada16d047a..0000000000 --- a/examples/quick/demos/maroon/maroon.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = app - -QT += qml quick -qtHaveModule(multimedia): QT += multimedia -SOURCES += main.cpp -RESOURCES += maroon.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/maroon -INSTALLS += target diff --git a/examples/quick/demos/maroon/maroon.qml b/examples/quick/demos/maroon/maroon.qml deleted file mode 100644 index d05ef57b64..0000000000 --- a/examples/quick/demos/maroon/maroon.qml +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Particles 2.0 -import "content" -import "content/logic.js" as Logic - -Item { - id: root - width: 320 - height: 480 - property var gameState - property bool passedSplash: false - - Image { - source:"content/gfx/background.png" - anchors.bottom: view.bottom - - ParticleSystem { - id: particles - anchors.fill: parent - - ImageParticle { - id: bubble - anchors.fill: parent - source: "content/gfx/catch.png" - opacity: 0.25 - } - - Wander { - xVariance: 25; - pace: 25; - } - - 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 - } - } - } - - Column { - id: view - y: -(height - 480) - width: 320 - - GameOverScreen { gameCanvas: canvas } - - 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" - } - NumberAnimation on x { from: 0; to: -(wave.width); duration: 16000; loops: Animation.Infinite } - 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 } - } - } - - Row { - opacity: 0.5 - Image { - id: wave2 - y: 25 - source: "content/gfx/wave.png" - } - Image { - y: 25 - source: "content/gfx/wave.png" - } - NumberAnimation on x { from: -(wave2.width); to: 0; duration: 32000; loops: Animation.Infinite } - 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 } - } - } - - Image { - source: "content/gfx/sunlight.png" - opacity: 0.02 - y: 0 - anchors.horizontalCenter: parent.horizontalCenter - 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 } - } - } - - Image { - source: "content/gfx/sunlight.png" - opacity: 0.04 - y: 20 - anchors.horizontalCenter: parent.horizontalCenter - 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 } - } - } - - Image { - source: "content/gfx/grid.png" - opacity: 0.5 - } - - GameCanvas { - id: canvas - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 - x: 32 - focus: true - } - - InfoBar { anchors.bottom: canvas.top; anchors.bottomMargin: 6; width: parent.width } - - //3..2..1..go - Timer { - id: countdownTimer - interval: 1000 - running: root.countdown < 5 - repeat: true - onTriggered: root.countdown++ - } - 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 {} } - } - } - } - - NewGameScreen { - onStartButtonClicked: root.passedSplash = true - } - } - - property int countdown: 10 - Timer { - id: gameStarter - interval: 4000 - running: false - repeat: false - onTriggered: Logic.startGame(canvas); - } - - states: [ - State { - name: "gameOn"; when: gameState.gameOver == false && passedSplash - PropertyChanges { target: view; y: -(height - 960) } - StateChangeScript { script: root.countdown = 0; } - PropertyChanges { target: gameStarter; running: true } - }, - State { - name: "gameOver"; when: gameState.gameOver == true - PropertyChanges { target: view; y: 0 } - } - ] - - transitions: Transition { - NumberAnimation { properties: "x,y"; duration: 1200; easing.type: Easing.OutQuad } - } - - Component.onCompleted: gameState = Logic.newGameState(canvas); -} diff --git a/examples/quick/demos/maroon/maroon.qmlproject b/examples/quick/demos/maroon/maroon.qmlproject deleted file mode 100644 index 752666114f..0000000000 --- a/examples/quick/demos/maroon/maroon.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "maroon.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/maroon/maroon.qrc b/examples/quick/demos/maroon/maroon.qrc deleted file mode 100644 index 52c2a4e513..0000000000 --- a/examples/quick/demos/maroon/maroon.qrc +++ /dev/null @@ -1,71 +0,0 @@ -<RCC> - <qresource prefix="/demos/maroon"> - <file>maroon.qml</file> - <file>content/BuildButton.qml</file> - <file>content/GameCanvas.qml</file> - <file>content/GameOverScreen.qml</file> - <file>content/InfoBar.qml</file> - <file>content/logic.js</file> - <file>content/NewGameScreen.qml</file> - <file>content/SoundEffect.qml</file> - <file>content/audio/bomb-action.wav</file> - <file>content/audio/catch-action.wav</file> - <file>content/audio/catch.wav</file> - <file>content/audio/currency.wav</file> - <file>content/audio/factory-action.wav</file> - <file>content/audio/melee-action.wav</file> - <file>content/audio/projectile-action.wav</file> - <file>content/audio/shooter-action.wav</file> - <file>content/gfx/background.png</file> - <file>content/gfx/bomb-action.png</file> - <file>content/gfx/bomb-idle.png</file> - <file>content/gfx/bomb.png</file> - <file>content/gfx/button-help.png</file> - <file>content/gfx/button-play.png</file> - <file>content/gfx/catch-action.png</file> - <file>content/gfx/catch.png</file> - <file>content/gfx/cloud.png</file> - <file>content/gfx/currency.png</file> - <file>content/gfx/dialog-bomb.png</file> - <file>content/gfx/dialog-factory.png</file> - <file>content/gfx/dialog-melee.png</file> - <file>content/gfx/dialog-pointer.png</file> - <file>content/gfx/dialog-shooter.png</file> - <file>content/gfx/dialog.png</file> - <file>content/gfx/factory-action.png</file> - <file>content/gfx/factory-idle.png</file> - <file>content/gfx/factory.png</file> - <file>content/gfx/grid.png</file> - <file>content/gfx/help.png</file> - <file>content/gfx/lifes.png</file> - <file>content/gfx/logo-bubble.png</file> - <file>content/gfx/logo-fish.png</file> - <file>content/gfx/logo.png</file> - <file>content/gfx/melee-action.png</file> - <file>content/gfx/melee-idle.png</file> - <file>content/gfx/melee.png</file> - <file>content/gfx/mob-idle.png</file> - <file>content/gfx/mob.png</file> - <file>content/gfx/points.png</file> - <file>content/gfx/projectile-action.png</file> - <file>content/gfx/projectile.png</file> - <file>content/gfx/scores.png</file> - <file>content/gfx/shooter-action.png</file> - <file>content/gfx/shooter-idle.png</file> - <file>content/gfx/shooter.png</file> - <file>content/gfx/sunlight.png</file> - <file>content/gfx/text-1.png</file> - <file>content/gfx/text-2.png</file> - <file>content/gfx/text-3.png</file> - <file>content/gfx/text-blank.png</file> - <file>content/gfx/text-gameover.png</file> - <file>content/gfx/text-go.png</file> - <file>content/gfx/wave.png</file> - <file>content/mobs/MobBase.qml</file> - <file>content/towers/Bomb.qml</file> - <file>content/towers/Factory.qml</file> - <file>content/towers/Melee.qml</file> - <file>content/towers/Ranged.qml</file> - <file>content/towers/TowerBase.qml</file> - </qresource> -</RCC> |