From 77e2f626e59bfddf32f2873edcfd52ea583dbf80 Mon Sep 17 00:00:00 2001 From: Grigorii Zimin Date: Fri, 3 Apr 2020 16:45:23 +0300 Subject: upload samegame app Fixes: AUTOSUITE-1474 Change-Id: I83f57f4c4d3f8d09bc3035519b09d0fa89290f93 Reviewed-by: Grigorii Zimin --- com.pelagicore.samegame/Main.qml | 48 ++ com.pelagicore.samegame/Samegame.qml | 383 ++++++++++++++ .../com.pelagicore.samegame.pro | 19 + com.pelagicore.samegame/content/Block.qml | 118 +++++ com.pelagicore.samegame/content/BlockEmitter.qml | 59 +++ com.pelagicore.samegame/content/Button.qml | 70 +++ com.pelagicore.samegame/content/GameArea.qml | 231 ++++++++ com.pelagicore.samegame/content/LogoAnimation.qml | 102 ++++ com.pelagicore.samegame/content/MenuEmitter.qml | 53 ++ com.pelagicore.samegame/content/PaintEmitter.qml | 67 +++ com.pelagicore.samegame/content/PrimaryPack.qml | 122 +++++ com.pelagicore.samegame/content/PuzzleBlock.qml | 111 ++++ com.pelagicore.samegame/content/SamegameText.qml | 49 ++ com.pelagicore.samegame/content/Settings.qml | 63 +++ com.pelagicore.samegame/content/SimpleBlock.qml | 108 ++++ com.pelagicore.samegame/content/SmokeText.qml | 83 +++ .../content/gfx/background-puzzle.png | Bin 0 -> 86666 bytes com.pelagicore.samegame/content/gfx/background.png | Bin 0 -> 101018 bytes com.pelagicore.samegame/content/gfx/bar.png | Bin 0 -> 10970 bytes .../content/gfx/blue-puzzle.png | Bin 0 -> 2219 bytes com.pelagicore.samegame/content/gfx/blue.png | Bin 0 -> 1018 bytes .../content/gfx/bubble-highscore.png | Bin 0 -> 2276 bytes .../content/gfx/bubble-puzzle.png | Bin 0 -> 2811 bytes com.pelagicore.samegame/content/gfx/but-game-1.png | Bin 0 -> 2728 bytes com.pelagicore.samegame/content/gfx/but-game-2.png | Bin 0 -> 3378 bytes com.pelagicore.samegame/content/gfx/but-game-3.png | Bin 0 -> 1423 bytes com.pelagicore.samegame/content/gfx/but-game-4.png | Bin 0 -> 2096 bytes .../content/gfx/but-game-new.png | Bin 0 -> 3662 bytes com.pelagicore.samegame/content/gfx/but-menu.png | Bin 0 -> 2391 bytes .../content/gfx/but-puzzle-next.png | Bin 0 -> 3658 bytes com.pelagicore.samegame/content/gfx/but-quit.png | Bin 0 -> 2100 bytes .../content/gfx/green-puzzle.png | Bin 0 -> 2271 bytes com.pelagicore.samegame/content/gfx/green.png | Bin 0 -> 1024 bytes com.pelagicore.samegame/content/gfx/icon-fail.png | Bin 0 -> 6549 bytes com.pelagicore.samegame/content/gfx/icon-ok.png | Bin 0 -> 7190 bytes com.pelagicore.samegame/content/gfx/icon-time.png | Bin 0 -> 1159 bytes com.pelagicore.samegame/content/gfx/logo-a.png | Bin 0 -> 1814 bytes com.pelagicore.samegame/content/gfx/logo-e.png | Bin 0 -> 1725 bytes com.pelagicore.samegame/content/gfx/logo-g.png | Bin 0 -> 1765 bytes com.pelagicore.samegame/content/gfx/logo-m.png | Bin 0 -> 1743 bytes com.pelagicore.samegame/content/gfx/logo-s.png | Bin 0 -> 1791 bytes com.pelagicore.samegame/content/gfx/logo.png | Bin 0 -> 3608 bytes .../content/gfx/particle-brick.png | Bin 0 -> 861 bytes .../content/gfx/particle-paint.png | Bin 0 -> 714 bytes .../content/gfx/particle-smoke.png | Bin 0 -> 5409 bytes com.pelagicore.samegame/content/gfx/red-puzzle.png | Bin 0 -> 2218 bytes com.pelagicore.samegame/content/gfx/red.png | Bin 0 -> 1018 bytes .../content/gfx/text-highscore-new.png | Bin 0 -> 6767 bytes .../content/gfx/text-highscore.png | Bin 0 -> 3179 bytes .../content/gfx/text-no-winner.png | Bin 0 -> 6321 bytes com.pelagicore.samegame/content/gfx/text-p1-go.png | Bin 0 -> 5395 bytes .../content/gfx/text-p1-won.png | Bin 0 -> 5618 bytes com.pelagicore.samegame/content/gfx/text-p1.png | Bin 0 -> 1751 bytes com.pelagicore.samegame/content/gfx/text-p2-go.png | Bin 0 -> 5874 bytes .../content/gfx/text-p2-won.png | Bin 0 -> 6177 bytes com.pelagicore.samegame/content/gfx/text-p2.png | Bin 0 -> 2381 bytes .../content/gfx/yellow-puzzle.png | Bin 0 -> 2239 bytes com.pelagicore.samegame/content/gfx/yellow.png | Bin 0 -> 1008 bytes .../content/levels/TemplateBase.qml | 71 +++ .../content/levels/TemplateBase.qmlc | Bin 0 -> 1260 bytes com.pelagicore.samegame/content/levels/level0.qml | 59 +++ com.pelagicore.samegame/content/levels/level1.qml | 59 +++ com.pelagicore.samegame/content/levels/level2.qml | 61 +++ com.pelagicore.samegame/content/levels/level3.qml | 60 +++ com.pelagicore.samegame/content/levels/level4.qml | 58 ++ com.pelagicore.samegame/content/levels/level5.qml | 59 +++ com.pelagicore.samegame/content/levels/level6.qml | 60 +++ com.pelagicore.samegame/content/levels/level7.qml | 58 ++ com.pelagicore.samegame/content/levels/level8.qml | 59 +++ com.pelagicore.samegame/content/levels/level9.qml | 62 +++ com.pelagicore.samegame/content/qmldir | 13 + com.pelagicore.samegame/content/samegame.js | 582 +++++++++++++++++++++ com.pelagicore.samegame/content/samegame.jsc | Bin 0 -> 14080 bytes com.pelagicore.samegame/icon.png | Bin 0 -> 803 bytes com.pelagicore.samegame/info.yaml | 17 + qt-auto-extra-apps.pro | 1 + 76 files changed, 2965 insertions(+) create mode 100644 com.pelagicore.samegame/Main.qml create mode 100644 com.pelagicore.samegame/Samegame.qml create mode 100644 com.pelagicore.samegame/com.pelagicore.samegame.pro create mode 100644 com.pelagicore.samegame/content/Block.qml create mode 100644 com.pelagicore.samegame/content/BlockEmitter.qml create mode 100644 com.pelagicore.samegame/content/Button.qml create mode 100644 com.pelagicore.samegame/content/GameArea.qml create mode 100644 com.pelagicore.samegame/content/LogoAnimation.qml create mode 100644 com.pelagicore.samegame/content/MenuEmitter.qml create mode 100644 com.pelagicore.samegame/content/PaintEmitter.qml create mode 100644 com.pelagicore.samegame/content/PrimaryPack.qml create mode 100644 com.pelagicore.samegame/content/PuzzleBlock.qml create mode 100644 com.pelagicore.samegame/content/SamegameText.qml create mode 100644 com.pelagicore.samegame/content/Settings.qml create mode 100644 com.pelagicore.samegame/content/SimpleBlock.qml create mode 100644 com.pelagicore.samegame/content/SmokeText.qml create mode 100644 com.pelagicore.samegame/content/gfx/background-puzzle.png create mode 100644 com.pelagicore.samegame/content/gfx/background.png create mode 100644 com.pelagicore.samegame/content/gfx/bar.png create mode 100644 com.pelagicore.samegame/content/gfx/blue-puzzle.png create mode 100644 com.pelagicore.samegame/content/gfx/blue.png create mode 100644 com.pelagicore.samegame/content/gfx/bubble-highscore.png create mode 100644 com.pelagicore.samegame/content/gfx/bubble-puzzle.png create mode 100644 com.pelagicore.samegame/content/gfx/but-game-1.png create mode 100644 com.pelagicore.samegame/content/gfx/but-game-2.png create mode 100644 com.pelagicore.samegame/content/gfx/but-game-3.png create mode 100644 com.pelagicore.samegame/content/gfx/but-game-4.png create mode 100644 com.pelagicore.samegame/content/gfx/but-game-new.png create mode 100644 com.pelagicore.samegame/content/gfx/but-menu.png create mode 100644 com.pelagicore.samegame/content/gfx/but-puzzle-next.png create mode 100644 com.pelagicore.samegame/content/gfx/but-quit.png create mode 100644 com.pelagicore.samegame/content/gfx/green-puzzle.png create mode 100644 com.pelagicore.samegame/content/gfx/green.png create mode 100644 com.pelagicore.samegame/content/gfx/icon-fail.png create mode 100644 com.pelagicore.samegame/content/gfx/icon-ok.png create mode 100644 com.pelagicore.samegame/content/gfx/icon-time.png create mode 100644 com.pelagicore.samegame/content/gfx/logo-a.png create mode 100644 com.pelagicore.samegame/content/gfx/logo-e.png create mode 100644 com.pelagicore.samegame/content/gfx/logo-g.png create mode 100644 com.pelagicore.samegame/content/gfx/logo-m.png create mode 100644 com.pelagicore.samegame/content/gfx/logo-s.png create mode 100644 com.pelagicore.samegame/content/gfx/logo.png create mode 100644 com.pelagicore.samegame/content/gfx/particle-brick.png create mode 100644 com.pelagicore.samegame/content/gfx/particle-paint.png create mode 100644 com.pelagicore.samegame/content/gfx/particle-smoke.png create mode 100644 com.pelagicore.samegame/content/gfx/red-puzzle.png create mode 100644 com.pelagicore.samegame/content/gfx/red.png create mode 100644 com.pelagicore.samegame/content/gfx/text-highscore-new.png create mode 100644 com.pelagicore.samegame/content/gfx/text-highscore.png create mode 100644 com.pelagicore.samegame/content/gfx/text-no-winner.png create mode 100644 com.pelagicore.samegame/content/gfx/text-p1-go.png create mode 100644 com.pelagicore.samegame/content/gfx/text-p1-won.png create mode 100644 com.pelagicore.samegame/content/gfx/text-p1.png create mode 100644 com.pelagicore.samegame/content/gfx/text-p2-go.png create mode 100644 com.pelagicore.samegame/content/gfx/text-p2-won.png create mode 100644 com.pelagicore.samegame/content/gfx/text-p2.png create mode 100644 com.pelagicore.samegame/content/gfx/yellow-puzzle.png create mode 100644 com.pelagicore.samegame/content/gfx/yellow.png create mode 100644 com.pelagicore.samegame/content/levels/TemplateBase.qml create mode 100644 com.pelagicore.samegame/content/levels/TemplateBase.qmlc create mode 100644 com.pelagicore.samegame/content/levels/level0.qml create mode 100644 com.pelagicore.samegame/content/levels/level1.qml create mode 100644 com.pelagicore.samegame/content/levels/level2.qml create mode 100644 com.pelagicore.samegame/content/levels/level3.qml create mode 100644 com.pelagicore.samegame/content/levels/level4.qml create mode 100644 com.pelagicore.samegame/content/levels/level5.qml create mode 100644 com.pelagicore.samegame/content/levels/level6.qml create mode 100644 com.pelagicore.samegame/content/levels/level7.qml create mode 100644 com.pelagicore.samegame/content/levels/level8.qml create mode 100644 com.pelagicore.samegame/content/levels/level9.qml create mode 100644 com.pelagicore.samegame/content/qmldir create mode 100644 com.pelagicore.samegame/content/samegame.js create mode 100644 com.pelagicore.samegame/content/samegame.jsc create mode 100644 com.pelagicore.samegame/icon.png create mode 100644 com.pelagicore.samegame/info.yaml diff --git a/com.pelagicore.samegame/Main.qml b/com.pelagicore.samegame/Main.qml new file mode 100644 index 0000000..fbcc315 --- /dev/null +++ b/com.pelagicore.samegame/Main.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.10 +import shared.utils 1.0 +import application.windows 1.0 + +import shared.Style 1.0 +import shared.Sizes 1.0 + +ApplicationCCWindow { + id: root + + Samegame { + x: root.exposedRect.x + y: root.exposedRect.y + width: root.exposedRect.width + height: root.exposedRect.height + } +} diff --git a/com.pelagicore.samegame/Samegame.qml b/com.pelagicore.samegame/Samegame.qml new file mode 100644 index 0000000..7746909 --- /dev/null +++ b/com.pelagicore.samegame/Samegame.qml @@ -0,0 +1,383 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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/samegame.js" as Logic +import "content" + +Rectangle { + id: root + width: Settings.screenWidth; height: Settings.screenHeight + property int acc: 0 + + + function loadPuzzle() { + if (gameCanvas.mode != "") + Logic.cleanUp(); + Logic.startNewGame(gameCanvas,"puzzle","levels/level"+acc+".qml") + } + function nextPuzzle() { + acc = (acc + 1) % 10; + loadPuzzle(); + } + Timer { + id: gameOverTimer + interval: 1500 + //mode will be reset by cleanUp(); + running : gameCanvas.gameOver && gameCanvas.mode == "puzzle" + repeat : false + onTriggered: { + Logic.cleanUp(); + nextPuzzle(); + } + } + + Image { + source: "content/gfx/background.png" + anchors.fill: parent + } + + GameArea { + id: gameCanvas + z: 1 + y: Settings.headerHeight + + width: parent.width + height: parent.height - Settings.headerHeight - Settings.footerHeight + + backgroundVisible: root.state == "in-game" + //UI has stricter constraints on this variable than the game does + onModeChanged: if (gameCanvas.mode != "puzzle") puzzleWon = false; + Age { + groups: ["redspots", "greenspots", "bluespots", "yellowspots"] + enabled: root.state == "" + system: gameCanvas.ps + } + + onPuzzleLost: acc--;//So that nextPuzzle() reloads the current one + + } + + Item { + id: menu + z: 2 + width: parent.width; + anchors.top: parent.top + anchors.bottom: bottomBar.top + + LogoAnimation { + x: 64 + y: Settings.headerHeight + particleSystem: gameCanvas.ps + running: root.state == "" + } + Row { + x: 112 + y: 20 + Image { source: "content/gfx/logo-a.png" } + Image { source: "content/gfx/logo-m.png" } + Image { source: "content/gfx/logo-e.png" } + } + + Column { + y: 100 + 40 + spacing: Settings.menuButtonSpacing + width: parent.width + height: parent.height - (140 + Settings.footerHeight) + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-1.png" + onClicked: { + if (root.state == "in-game") + return //Prevent double clicking + root.state = "in-game" + gameCanvas.blockFile = "Block.qml" + gameCanvas.background = "gfx/background.png" + arcadeTimer.start(); + } + //Emitted particles don't fade out, because ImageParticle is on the GameArea + system: gameCanvas.ps + group: "green" + Timer { + id: arcadeTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: Logic.startNewGame(gameCanvas) + } + } + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-2.png" + onClicked: { + if (root.state == "in-game") + return + root.state = "in-game" + gameCanvas.blockFile = "Block.qml" + gameCanvas.background = "gfx/background.png" + twopTimer.start(); + } + system: gameCanvas.ps + group: "green" + Timer { + id: twopTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: Logic.startNewGame(gameCanvas, "multiplayer") + } + } + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-3.png" + onClicked: { + if (root.state == "in-game") + return + root.state = "in-game" + gameCanvas.blockFile = "SimpleBlock.qml" + gameCanvas.background = "gfx/background.png" + endlessTimer.start(); + } + system: gameCanvas.ps + group: "blue" + Timer { + id: endlessTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: Logic.startNewGame(gameCanvas, "endless") + } + } + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-4.png" + group: "yellow" + onClicked: { + if (root.state == "in-game") + return + root.state = "in-game" + gameCanvas.blockFile = "PuzzleBlock.qml" + gameCanvas.background = "gfx/background.png" + puzzleTimer.start(); + } + Timer { + id: puzzleTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: loadPuzzle(); + } + system: gameCanvas.ps + } + } + } + + Image { + id: scoreBar + source: "content/gfx/bar.png" + width: parent.width + z: 6 + y: -Settings.headerHeight + height: Settings.headerHeight + Behavior on opacity { NumberAnimation {} } + SamegameText { + id: arcadeScore + anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} + text: 'P1: ' + gameCanvas.score + font.pixelSize: Settings.fontPixelSize + textFormat: Text.StyledText + color: "white" + opacity: gameCanvas.mode == "arcade" ? 1 : 0 + Behavior on opacity { NumberAnimation {} } + } + SamegameText { + id: arcadeHighScore + anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} + text: 'Highscore: ' + gameCanvas.highScore + opacity: gameCanvas.mode == "arcade" ? 1 : 0 + } + SamegameText { + id: p1Score + anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} + text: 'P1: ' + gameCanvas.score + opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 + } + SamegameText { + id: p2Score + anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} + text: 'P2: ' + gameCanvas.score2 + opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 + rotation: 180 + } + SamegameText { + id: puzzleMoves + anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} + text: 'Moves: ' + gameCanvas.moves + opacity: gameCanvas.mode == "puzzle" ? 1 : 0 + } + SamegameText { + Image { + source: "content/gfx/icon-time.png" + x: -20 + } + id: puzzleTime + anchors { topMargin: 3; top: parent.top; horizontalCenter: parent.horizontalCenter; + horizontalCenterOffset: 20} + text: "00:00" + opacity: gameCanvas.mode == "puzzle" ? 1 : 0 + Timer { + interval: 1000 + repeat: true + running: gameCanvas.mode == "puzzle" && !gameCanvas.gameOver + onTriggered: { + var elapsed = Math.floor((new Date() - Logic.gameDuration)/ 1000.0); + var mins = Math.floor(elapsed/60.0); + var secs = (elapsed % 60); + puzzleTime.text = (mins < 10 ? "0" : "") + mins + + ":" + (secs < 10 ? "0" : "") + secs; + } + } + } + SamegameText { + id: puzzleScore + anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} + text: 'Score: ' + gameCanvas.score + opacity: gameCanvas.mode == "puzzle" ? 1 : 0 + } + } + + Image { + id: bottomBar + width: parent.width + height: Settings.footerHeight + source: "content/gfx/bar.png" + y: parent.height - Settings.footerHeight; + z: 2 + Button { + id: menuButton + height: Settings.toolButtonHeight + imgSrc: "content/gfx/but-menu.png" + visible: (root.state == "in-game"); + onClicked: {root.state = ""; Logic.cleanUp(); gameCanvas.mode = ""} + anchors { verticalCenter: parent.verticalCenter; leftMargin: 0 } + } + Button { + id: againButton + height: Settings.toolButtonHeight + imgSrc: "content/gfx/but-game-new.png" + visible: (root.state == "in-game"); + opacity: gameCanvas.gameOver && (gameCanvas.mode == "arcade" + || gameCanvas.mode == "multiplayer") + Behavior on opacity{ NumberAnimation {} } + onClicked: {if (gameCanvas.gameOver) {Logic.startNewGame(gameCanvas, gameCanvas.mode);}} + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } + } + Button { + id: nextButton + height: Settings.toolButtonHeight + imgSrc: "content/gfx/but-puzzle-next.png" + visible: (root.state == "in-game") && gameCanvas.mode == "puzzle" + && gameCanvas.puzzleWon + opacity: gameCanvas.puzzleWon ? 1 : 0 + Behavior on opacity{ NumberAnimation {} } + onClicked: {if (gameCanvas.puzzleWon) nextPuzzle();} + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } + } + } + + Connections { + target: root + onStateChanged: stateChangeAnim.running = true + } + SequentialAnimation { + id: stateChangeAnim + ParallelAnimation { + NumberAnimation { + target: bottomBar; property: "y"; to: root.height; duration: Settings.menuDelay/2; + easing.type: Easing.OutQuad + } + NumberAnimation { + target: scoreBar; property: "y"; to: -Settings.headerHeight; + duration: Settings.menuDelay/2; easing.type: Easing.OutQuad + } + } + ParallelAnimation { + NumberAnimation { + target: bottomBar; property: "y"; to: root.height - Settings.footerHeight; + duration: Settings.menuDelay/2; easing.type: Easing.OutBounce + } + NumberAnimation { target: scoreBar; property: "y"; + to: root.state == "" ? -Settings.headerHeight : 0; + duration: Settings.menuDelay/2; easing.type: Easing.OutBounce + } + } + } + + states: [ + State { + name: "in-game" + PropertyChanges { + target: menu + opacity: 0 + visible: false + } + } + ] + + transitions: [ + Transition { + NumberAnimation {properties: "x,y,opacity"} + } + ] + + //"Debug mode" + focus: true + Keys.onAsteriskPressed: Logic.nuke(); + Keys.onSpacePressed: gameCanvas.puzzleWon = true; +} diff --git a/com.pelagicore.samegame/com.pelagicore.samegame.pro b/com.pelagicore.samegame/com.pelagicore.samegame.pro new file mode 100644 index 0000000..4e2a0a9 --- /dev/null +++ b/com.pelagicore.samegame/com.pelagicore.samegame.pro @@ -0,0 +1,19 @@ +TEMPLATE = aux + +FILES += info.yaml \ + icon.png \ + Main.qml \ + Samegame.qml + +app.files = $$FILES +app.path = /apps/com.pelagicore.samegame + +content.files += content +content.path = /apps/com.pelagicore.samegame + +INSTALLS += app content + +AM_MANIFEST = info.yaml +AM_PACKAGE_DIR = $$app.path + +load(am-app) diff --git a/com.pelagicore.samegame/content/Block.qml b/com.pelagicore.samegame/content/Block.qml new file mode 100644 index 0000000..f09b3ed --- /dev/null +++ b/com.pelagicore.samegame/content/Block.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Item { + id: block + property bool dying: false + property bool spawned: false + property int type: 0 + property ParticleSystem particleSystem + + Behavior on x { + enabled: spawned; + SpringAnimation{ spring: 2; damping: 0.2 } + } + Behavior on y { + SpringAnimation{ spring: 2; damping: 0.2 } + } + + Image { + id: img + source: { + if (type == 0){ + "gfx/red.png"; + } else if (type == 1) { + "gfx/blue.png"; + } else if (type == 2) { + "gfx/green.png"; + } else { + "gfx/yellow.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.fill: parent + } + + //Foreground particles + BlockEmitter { + id: particles + system: particleSystem + group: { + if (type == 0){ + "red"; + } else if (type == 1) { + "blue"; + } else if (type == 2) { + "green"; + } else { + "yellow"; + } + } + anchors.fill: parent + } + + //Paint particles on the background + PaintEmitter { + id: particles2 + system: particleSystem + } + + states: [ + State { + name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + + State { + name: "DeathState"; when: dying == true + StateChangeScript { + script: { + particleSystem.paused = false; particles.pulse(100); particles2.pulse(100) + } + } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/com.pelagicore.samegame/content/BlockEmitter.qml b/com.pelagicore.samegame/content/BlockEmitter.qml new file mode 100644 index 0000000..b7ea494 --- /dev/null +++ b/com.pelagicore.samegame/content/BlockEmitter.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 +// Needed for singletons QTBUG-34418 +import "." + +Emitter { + property Item block: parent + velocity: TargetDirection { + targetX: block.width/2; targetY: block.height/2; magnitude: -40; magnitudeVariation: 40 + } + acceleration: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -100;} + shape: EllipseShape{fill:true} + enabled: false; + lifeSpan: 700; lifeSpanVariation: 100 + emitRate: 1000 + maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number) + size: Settings.blockSize * 0.85 + endSize: Settings.blockSize * 0.85 /2 +} diff --git a/com.pelagicore.samegame/content/Button.qml b/com.pelagicore.samegame/content/Button.qml new file mode 100644 index 0000000..8cbfe53 --- /dev/null +++ b/com.pelagicore.samegame/content/Button.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Item { + property alias imgSrc: image.source + property alias system: emitter.system + property alias group: emitter.group + signal clicked + property bool rotatedButton: false + + width: image.width + height: image.sourceSize.height + Image { + id: image + height: parent.height + width: height/sourceSize.height * sourceSize.width + + anchors.horizontalCenter: parent.horizontalCenter + rotation: rotatedButton ? ((Math.random() * 3 + 2) * (Math.random() <= 0.5 ? -1 : 1)) : 0 + MenuEmitter { + id: emitter + anchors.fill: parent + //shape: MaskShape {source: image.source} + } + } + MouseArea { + anchors.fill: parent + onClicked: {parent.clicked(); emitter.burst(400);} + } +} diff --git a/com.pelagicore.samegame/content/GameArea.qml b/com.pelagicore.samegame/content/GameArea.qml new file mode 100644 index 0000000..fccb413 --- /dev/null +++ b/com.pelagicore.samegame/content/GameArea.qml @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "samegame.js" as Logic +import "." + +Item { + id: gameCanvas + property bool gameOver: true + property int score: 0 + property int highScore: 0 + property int moves: 0 + property string mode: "" + property ParticleSystem ps: particleSystem + //For easy theming + property alias backgroundVisible: bg.visible + property string background: "gfx/background.png" + property string blockFile: "Block.qml" + property int blockSize: Settings.blockSize + onBlockFileChanged: Logic.changeBlock(blockFile); + property alias particlePack: auxLoader.source + //For multiplayer + property int score2: 0 + property int curTurn: 1 + property bool autoTurnChange: false + signal swapPlayers + property bool swapping: false + //onSwapPlayers: if (autoTurnChange) Logic.turnChange();//Now implemented below + //For puzzle + property url level + property bool puzzleWon: false + signal puzzleLost //Since root is tracking the puzzle progress + function showPuzzleEnd (won) { + if (won) { + smokeParticle.color = Qt.rgba(0,1,0,0); + puzzleWin.play(); + } else { + smokeParticle.color = Qt.rgba(1,0,0,0); + puzzleFail.play(); + puzzleLost(); + } + } + function showPuzzleGoal (str) { + puzzleTextBubble.opacity = 1; + puzzleTextLabel.text = str; + } + Image { + id: bg + z: -1 + anchors.fill: parent + source: background; + fillMode: Image.PreserveAspectCrop + } + + MouseArea { + anchors.fill: parent; onClicked: { + if (puzzleTextBubble.opacity == 1) { + puzzleTextBubble.opacity = 0; + Logic.finishLoadingMap(); + } else if (!swapping) { + Logic.handleClick(mouse.x,mouse.y); + } + } + } + + Image { + id: highScoreTextBubble + opacity: mode == "arcade" && gameOver && gameCanvas.score == gameCanvas.highScore ? 1 : 0 + Behavior on opacity { NumberAnimation {} } + anchors.centerIn: parent + z: 10 + source: "gfx/bubble-highscore.png" + Image { + anchors.centerIn: parent + source: "gfx/text-highscore-new.png" + rotation: -10 + } + } + + Image { + id: puzzleTextBubble + anchors.centerIn: parent + opacity: 0 + Behavior on opacity { NumberAnimation {} } + z: 10 + source: "gfx/bubble-puzzle.png" + Connections { + target: gameCanvas + onModeChanged: { + if (mode != "puzzle" && puzzleTextBubble.opacity > 0) + puzzleTextBubble.opacity = 0; + } + } + Text { + id: puzzleTextLabel + width: parent.width - 24 + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + color: "white" + font.pixelSize: 24 + font.bold: true + wrapMode: Text.WordWrap + } + } + onModeChanged: { + p1WonImg.opacity = 0; + p2WonImg.opacity = 0; + } + SmokeText { id: puzzleWin; source: "gfx/icon-ok.png"; system: particleSystem } + SmokeText { id: puzzleFail; source: "gfx/icon-fail.png"; system: particleSystem } + + onSwapPlayers: { + smokeParticle.color = "yellow" + Logic.turnChange(); + if (curTurn == 1) { + p1Text.play(); + } else { + p2Text.play(); + } + clickDelay.running = true; + } + SequentialAnimation { + id: clickDelay + ScriptAction { script: gameCanvas.swapping = true; } + PauseAnimation { duration: 750 } + ScriptAction { script: gameCanvas.swapping = false; } + } + + SmokeText { + id: p1Text; source: "gfx/text-p1-go.png"; + system: particleSystem; playerNum: 1 + opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 + } + + SmokeText { + id: p2Text; source: "gfx/text-p2-go.png"; + system: particleSystem; playerNum: 2 + opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 + } + + onGameOverChanged: { + if (gameCanvas.mode == "multiplayer") { + if (gameCanvas.score >= gameCanvas.score2) { + p1WonImg.opacity = 1; + } else { + p2WonImg.opacity = 1; + } + } + } + Image { + id: p1WonImg + source: "gfx/text-p1-won.png" + anchors.centerIn: parent + opacity: 0 + Behavior on opacity { NumberAnimation {} } + z: 10 + } + Image { + id: p2WonImg + source: "gfx/text-p2-won.png" + anchors.centerIn: parent + opacity: 0 + Behavior on opacity { NumberAnimation {} } + z: 10 + } + + ParticleSystem{ + id: particleSystem; + anchors.fill: parent + z: 5 + ImageParticle { + id: smokeParticle + groups: ["smoke"] + source: "gfx/particle-smoke.png" + alpha: 0.1 + alphaVariation: 0.1 + color: "yellow" + } + Loader { + id: auxLoader + anchors.fill: parent + source: "PrimaryPack.qml" + onItemChanged: { + if (item && "particleSystem" in item) + item.particleSystem = particleSystem + if (item && "gameArea" in item) + item.gameArea = gameCanvas + } + } + } +} + diff --git a/com.pelagicore.samegame/content/LogoAnimation.qml b/com.pelagicore.samegame/content/LogoAnimation.qml new file mode 100644 index 0000000..99a056a --- /dev/null +++ b/com.pelagicore.samegame/content/LogoAnimation.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Item { + id: container //Positioned where the 48x48 S/G should be + property alias running: mainAnim.running + property ParticleSystem particleSystem + property int dur: 500 + signal boomTime + Image { + id: s1 + source: "gfx/logo-s.png" + y: 0 + } + Image { + id: g1 + source: "gfx/logo-g.png" + y: -128 + } + Column { + Repeater { + model: 2 + Item { + width: 48 + height: 48 + BlockEmitter { + id: emitter + anchors.fill: parent + group: "red" + system: particleSystem + Connections { + target: container + onBoomTime: emitter.pulse(100); + } + } + } + } + } + SequentialAnimation { + id: mainAnim + running: true + loops: -1 + PropertyAction { target: g1; property: "y"; value: -128} + PropertyAction { target: g1; property: "opacity"; value: 1} + PropertyAction { target: s1; property: "y"; value: 0} + PropertyAction { target: s1; property: "opacity"; value: 1} + NumberAnimation { target: g1; property: "y"; from: -96; to: -48; duration: dur} + ParallelAnimation { + NumberAnimation { target: g1; property: "y"; from: -48; to: 0; duration: dur} + NumberAnimation { target: s1; property: "y"; from: 0; to: 48; duration: dur } + } + PauseAnimation { duration: dur } + ScriptAction { script: container.boomTime(); } + ParallelAnimation { + NumberAnimation { target: g1; property: "opacity"; to: 0; duration: dur } + NumberAnimation { target: s1; property: "opacity"; to: 0; duration: dur } + } + PropertyAction { target: s1; property: "y"; value: -128} + PropertyAction { target: s1; property: "opacity"; value: 1} + NumberAnimation { target: s1; property: "y"; from: -96; to: 0; duration: dur * 2} + } +} diff --git a/com.pelagicore.samegame/content/MenuEmitter.qml b/com.pelagicore.samegame/content/MenuEmitter.qml new file mode 100644 index 0000000..694badb --- /dev/null +++ b/com.pelagicore.samegame/content/MenuEmitter.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Emitter { + anchors.fill: parent + velocity: AngleDirection{angleVariation: 360; magnitude: 140; magnitudeVariation: 40} + enabled: false; + lifeSpan: 500; + emitRate: 1 + size: 28 + endSize: 14 + group: "yellow" +} diff --git a/com.pelagicore.samegame/content/PaintEmitter.qml b/com.pelagicore.samegame/content/PaintEmitter.qml new file mode 100644 index 0000000..1c2c841 --- /dev/null +++ b/com.pelagicore.samegame/content/PaintEmitter.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "." + +Emitter { + property Item block: parent + anchors.fill: parent + shape: EllipseShape { fill: true } + group: { + if (block.type == 0){ + "redspots"; + } else if (block.type == 1) { + "bluespots"; + } else if (block.type == 2) { + "greenspots"; + } else { + "yellowspots"; + } + } + size: Settings.blockSize * 2 + endSize: Settings.blockSize/2 + lifeSpan: 30000 + enabled: false + emitRate: 60 + maximumEmitted: 60 + velocity: PointDirection{ y: 4; yVariation: 4 } +} diff --git a/com.pelagicore.samegame/content/PrimaryPack.qml b/com.pelagicore.samegame/content/PrimaryPack.qml new file mode 100644 index 0000000..ecb30eb --- /dev/null +++ b/com.pelagicore.samegame/content/PrimaryPack.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Item { + id: container + property ParticleSystem particleSystem + property GameArea gameArea + onGameAreaChanged: bgstacker.parent = gameArea;//Move to direct child of game canvas + Item { + id: bgstacker + z: 0 + ImageParticle { + groups: ["yellowspots"] + color: Qt.darker("yellow");//Actually want desaturated... + system: particleSystem + source: "gfx/particle-paint.png" + colorVariation: 0.2 + alpha: 0.2 + entryEffect: ImageParticle.None + } + ImageParticle { + groups: ["redspots"] + system: particleSystem + color: Qt.darker("red");//Actually want desaturated... + source: "gfx/particle-paint.png" + colorVariation: 0.2 + alpha: 0.2 + entryEffect: ImageParticle.None + } + ImageParticle { + groups: ["greenspots"] + system: particleSystem + color: Qt.darker("green");//Actually want desaturated... + source: "gfx/particle-paint.png" + colorVariation: 0.2 + alpha: 0.2 + entryEffect: ImageParticle.None + } + ImageParticle { + groups: ["bluespots"] + system: particleSystem + color: Qt.darker("blue");//Actually want desaturated... + source: "gfx/particle-paint.png" + colorVariation: 0.2 + alpha: 0.2 + entryEffect: ImageParticle.None + } + } + ImageParticle { + groups: ["yellow"] + system: particleSystem + color: Qt.darker("yellow");//Actually want desaturated... + source: "gfx/particle-brick.png" + colorVariation: 0.4 + alpha: 0.1 + } + ImageParticle { + groups: ["red"] + system: particleSystem + color: Qt.darker("red");//Actually want desaturated... + source: "gfx/particle-brick.png" + colorVariation: 0.4 + alpha: 0.1 + } + ImageParticle { + groups: ["green"] + system: particleSystem + color: Qt.darker("green");//Actually want desaturated... + source: "gfx/particle-brick.png" + colorVariation: 0.4 + alpha: 0.1 + } + ImageParticle { + groups: ["blue"] + system: particleSystem + color: Qt.darker("blue");//Actually want desaturated... + source: "gfx/particle-brick.png" + colorVariation: 0.4 + alpha: 0.1 + } +} diff --git a/com.pelagicore.samegame/content/PuzzleBlock.qml b/com.pelagicore.samegame/content/PuzzleBlock.qml new file mode 100644 index 0000000..e91bf48 --- /dev/null +++ b/com.pelagicore.samegame/content/PuzzleBlock.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Item { + id: block + property bool dying: false + property bool spawned: false + property int type: 0 + property ParticleSystem particleSystem + + Behavior on x { + enabled: spawned; + NumberAnimation{ easing.type: Easing.OutBounce } + } + Behavior on y { + NumberAnimation{ easing.type: Easing.InQuad } + } + + Image { + id: img + source: { + if (type == 0){ + "gfx/red-puzzle.png"; + } else if (type == 1) { + "gfx/blue-puzzle.png"; + } else if (type == 2) { + "gfx/green-puzzle.png"; + } else { + "gfx/yellow-puzzle.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.centerIn: parent + anchors.verticalCenterOffset: -4 + anchors.horizontalCenterOffset: 4 + } + + //Foreground particles + BlockEmitter { + id: particles + system: particleSystem + group: { + if (type == 0){ + "red"; + } else if (type == 1) { + "blue"; + } else if (type == 2) { + "green"; + } else { + "yellow"; + } + } + anchors.fill: parent + } + + states: [ + State { + name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + + State { + name: "DeathState"; when: dying == true + PropertyChanges { target: img; scale: 2 } + StateChangeScript { script: particles.pulse(200); } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/com.pelagicore.samegame/content/SamegameText.qml b/com.pelagicore.samegame/content/SamegameText.qml new file mode 100644 index 0000000..1ff447e --- /dev/null +++ b/com.pelagicore.samegame/content/SamegameText.qml @@ -0,0 +1,49 @@ +/*************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "." + +Text { + font.pixelSize: Settings.fontPixelSize; + color: "white"; + textFormat: Text.StyledText; + Behavior on opacity { NumberAnimation {} } +} diff --git a/com.pelagicore.samegame/content/Settings.qml b/com.pelagicore.samegame/content/Settings.qml new file mode 100644 index 0000000..b013b50 --- /dev/null +++ b/com.pelagicore.samegame/content/Settings.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 Singleton +import QtQml 2.0 + +import shared.Style 1.0 +import shared.Sizes 1.0 + +QtObject { + property int screenHeight: 480 + property int screenWidth: 320 + + property int menuDelay: 500 + + property int headerHeight: Sizes.dp(20) + property int footerHeight: Sizes.dp(80) + + property int fontPixelSize: Sizes.dp(16) + + property int blockSize: Sizes.dp(71) + + property int toolButtonHeight: Sizes.dp(60) + + property int menuButtonSpacing: Sizes.dp(36) +} diff --git a/com.pelagicore.samegame/content/SimpleBlock.qml b/com.pelagicore.samegame/content/SimpleBlock.qml new file mode 100644 index 0000000..1f15ce5 --- /dev/null +++ b/com.pelagicore.samegame/content/SimpleBlock.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Item { + id: block + property bool dying: false + property bool spawned: false + property int type: 0 + property ParticleSystem particleSystem + + Behavior on x { + enabled: spawned; + SpringAnimation{ spring: 2; damping: 0.2 } + } + Behavior on y { + SpringAnimation{ spring: 2; damping: 0.2 } + } + + Image { + id: img + source: { + if (type == 0){ + "gfx/red.png"; + } else if (type == 1) { + "gfx/blue.png"; + } else if (type == 2) { + "gfx/green.png"; + } else { + "gfx/yellow.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.fill: parent + } + + //Foreground particles + BlockEmitter { + id: particles + system: particleSystem + group: { + if (type == 0){ + "red"; + } else if (type == 1) { + "blue"; + } else if (type == 2) { + "green"; + } else { + "yellow"; + } + } + anchors.fill: parent + } + + states: [ + State { + name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + + State { + name: "DeathState"; when: dying == true + StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100); } } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/com.pelagicore.samegame/content/SmokeText.qml b/com.pelagicore.samegame/content/SmokeText.qml new file mode 100644 index 0000000..85ebb14 --- /dev/null +++ b/com.pelagicore.samegame/content/SmokeText.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Item { + z: 10 + property alias source: img.source + property alias system: emitter.system + property int playerNum: 1 + function play() { + anim.running = true; + } + anchors.centerIn: parent + Image { + opacity: 0 + id: img + anchors.centerIn: parent + rotation: playerNum == 1 ? -8 : -5 + Emitter { + id: emitter + group: "smoke" + anchors.fill: parent + shape: MaskShape { source: img.source } + enabled: false + emitRate: 1000 + lifeSpan: 600 + size: 64 + endSize: 32 + velocity: AngleDirection { angleVariation: 360; magnitudeVariation: 160 } + } + } + SequentialAnimation { + id: anim + running: false + PauseAnimation { duration: 500} + ParallelAnimation { + NumberAnimation { target: img; property: "opacity"; from: 0.1; to: 1.0 } + NumberAnimation { target: img; property: "scale"; from: 0.1; to: 1.0 } + } + PauseAnimation { duration: 250} + ScriptAction { script: emitter.pulse(100); } + NumberAnimation { target: img; property: "opacity"; from: 1.0; to: 0.0 } + } +} diff --git a/com.pelagicore.samegame/content/gfx/background-puzzle.png b/com.pelagicore.samegame/content/gfx/background-puzzle.png new file mode 100644 index 0000000..c2eca5f Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/background-puzzle.png differ diff --git a/com.pelagicore.samegame/content/gfx/background.png b/com.pelagicore.samegame/content/gfx/background.png new file mode 100644 index 0000000..60f57b6 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/background.png differ diff --git a/com.pelagicore.samegame/content/gfx/bar.png b/com.pelagicore.samegame/content/gfx/bar.png new file mode 100644 index 0000000..4953cd6 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/bar.png differ diff --git a/com.pelagicore.samegame/content/gfx/blue-puzzle.png b/com.pelagicore.samegame/content/gfx/blue-puzzle.png new file mode 100644 index 0000000..e550d59 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/blue-puzzle.png differ diff --git a/com.pelagicore.samegame/content/gfx/blue.png b/com.pelagicore.samegame/content/gfx/blue.png new file mode 100644 index 0000000..b8161c0 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/blue.png differ diff --git a/com.pelagicore.samegame/content/gfx/bubble-highscore.png b/com.pelagicore.samegame/content/gfx/bubble-highscore.png new file mode 100644 index 0000000..c4e38df Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/bubble-highscore.png differ diff --git a/com.pelagicore.samegame/content/gfx/bubble-puzzle.png b/com.pelagicore.samegame/content/gfx/bubble-puzzle.png new file mode 100644 index 0000000..278556b Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/bubble-puzzle.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-game-1.png b/com.pelagicore.samegame/content/gfx/but-game-1.png new file mode 100644 index 0000000..3343b7f Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-game-1.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-game-2.png b/com.pelagicore.samegame/content/gfx/but-game-2.png new file mode 100644 index 0000000..afba106 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-game-2.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-game-3.png b/com.pelagicore.samegame/content/gfx/but-game-3.png new file mode 100644 index 0000000..adea77a Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-game-3.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-game-4.png b/com.pelagicore.samegame/content/gfx/but-game-4.png new file mode 100644 index 0000000..18c922b Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-game-4.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-game-new.png b/com.pelagicore.samegame/content/gfx/but-game-new.png new file mode 100644 index 0000000..257e182 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-game-new.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-menu.png b/com.pelagicore.samegame/content/gfx/but-menu.png new file mode 100644 index 0000000..8440e87 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-menu.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-puzzle-next.png b/com.pelagicore.samegame/content/gfx/but-puzzle-next.png new file mode 100644 index 0000000..7e3ed41 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-puzzle-next.png differ diff --git a/com.pelagicore.samegame/content/gfx/but-quit.png b/com.pelagicore.samegame/content/gfx/but-quit.png new file mode 100644 index 0000000..95c77ce Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/but-quit.png differ diff --git a/com.pelagicore.samegame/content/gfx/green-puzzle.png b/com.pelagicore.samegame/content/gfx/green-puzzle.png new file mode 100644 index 0000000..581f76f Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/green-puzzle.png differ diff --git a/com.pelagicore.samegame/content/gfx/green.png b/com.pelagicore.samegame/content/gfx/green.png new file mode 100644 index 0000000..da4cca5 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/green.png differ diff --git a/com.pelagicore.samegame/content/gfx/icon-fail.png b/com.pelagicore.samegame/content/gfx/icon-fail.png new file mode 100644 index 0000000..4072611 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/icon-fail.png differ diff --git a/com.pelagicore.samegame/content/gfx/icon-ok.png b/com.pelagicore.samegame/content/gfx/icon-ok.png new file mode 100644 index 0000000..15a8442 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/icon-ok.png differ diff --git a/com.pelagicore.samegame/content/gfx/icon-time.png b/com.pelagicore.samegame/content/gfx/icon-time.png new file mode 100644 index 0000000..9490e49 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/icon-time.png differ diff --git a/com.pelagicore.samegame/content/gfx/logo-a.png b/com.pelagicore.samegame/content/gfx/logo-a.png new file mode 100644 index 0000000..20c20ba Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/logo-a.png differ diff --git a/com.pelagicore.samegame/content/gfx/logo-e.png b/com.pelagicore.samegame/content/gfx/logo-e.png new file mode 100644 index 0000000..dd663f1 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/logo-e.png differ diff --git a/com.pelagicore.samegame/content/gfx/logo-g.png b/com.pelagicore.samegame/content/gfx/logo-g.png new file mode 100644 index 0000000..a319bf9 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/logo-g.png differ diff --git a/com.pelagicore.samegame/content/gfx/logo-m.png b/com.pelagicore.samegame/content/gfx/logo-m.png new file mode 100644 index 0000000..6a029b3 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/logo-m.png differ diff --git a/com.pelagicore.samegame/content/gfx/logo-s.png b/com.pelagicore.samegame/content/gfx/logo-s.png new file mode 100644 index 0000000..963b175 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/logo-s.png differ diff --git a/com.pelagicore.samegame/content/gfx/logo.png b/com.pelagicore.samegame/content/gfx/logo.png new file mode 100644 index 0000000..e900edd Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/logo.png differ diff --git a/com.pelagicore.samegame/content/gfx/particle-brick.png b/com.pelagicore.samegame/content/gfx/particle-brick.png new file mode 100644 index 0000000..5c83896 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/particle-brick.png differ diff --git a/com.pelagicore.samegame/content/gfx/particle-paint.png b/com.pelagicore.samegame/content/gfx/particle-paint.png new file mode 100644 index 0000000..9bd0a2a Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/particle-paint.png differ diff --git a/com.pelagicore.samegame/content/gfx/particle-smoke.png b/com.pelagicore.samegame/content/gfx/particle-smoke.png new file mode 100644 index 0000000..b27f954 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/particle-smoke.png differ diff --git a/com.pelagicore.samegame/content/gfx/red-puzzle.png b/com.pelagicore.samegame/content/gfx/red-puzzle.png new file mode 100644 index 0000000..9ceb17e Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/red-puzzle.png differ diff --git a/com.pelagicore.samegame/content/gfx/red.png b/com.pelagicore.samegame/content/gfx/red.png new file mode 100644 index 0000000..681810f Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/red.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-highscore-new.png b/com.pelagicore.samegame/content/gfx/text-highscore-new.png new file mode 100644 index 0000000..50f7fcd Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-highscore-new.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-highscore.png b/com.pelagicore.samegame/content/gfx/text-highscore.png new file mode 100644 index 0000000..7198c27 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-highscore.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-no-winner.png b/com.pelagicore.samegame/content/gfx/text-no-winner.png new file mode 100644 index 0000000..b4a6685 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-no-winner.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-p1-go.png b/com.pelagicore.samegame/content/gfx/text-p1-go.png new file mode 100644 index 0000000..c7bd2a5 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-p1-go.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-p1-won.png b/com.pelagicore.samegame/content/gfx/text-p1-won.png new file mode 100644 index 0000000..41c2eb7 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-p1-won.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-p1.png b/com.pelagicore.samegame/content/gfx/text-p1.png new file mode 100644 index 0000000..b59c87b Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-p1.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-p2-go.png b/com.pelagicore.samegame/content/gfx/text-p2-go.png new file mode 100644 index 0000000..f03cd93 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-p2-go.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-p2-won.png b/com.pelagicore.samegame/content/gfx/text-p2-won.png new file mode 100644 index 0000000..116b7f2 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-p2-won.png differ diff --git a/com.pelagicore.samegame/content/gfx/text-p2.png b/com.pelagicore.samegame/content/gfx/text-p2.png new file mode 100644 index 0000000..d4f2bc7 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/text-p2.png differ diff --git a/com.pelagicore.samegame/content/gfx/yellow-puzzle.png b/com.pelagicore.samegame/content/gfx/yellow-puzzle.png new file mode 100644 index 0000000..66044c8 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/yellow-puzzle.png differ diff --git a/com.pelagicore.samegame/content/gfx/yellow.png b/com.pelagicore.samegame/content/gfx/yellow.png new file mode 100644 index 0000000..6bc5d38 Binary files /dev/null and b/com.pelagicore.samegame/content/gfx/yellow.png differ diff --git a/com.pelagicore.samegame/content/levels/TemplateBase.qml b/com.pelagicore.samegame/content/levels/TemplateBase.qml new file mode 100644 index 0000000..df47b90 --- /dev/null +++ b/com.pelagicore.samegame/content/levels/TemplateBase.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +Rectangle{ + id: control + property int scoreTarget: -1 + property int timeTarget: -1 + property int moveTarget: -1 + property bool mustClear: true + property string goalText: "Clear the level..." + + property var startingGrid //If this isn't an array of ints, we will refuse to load the level. + /* Ints are 0-4. If not enough ints are there it will be prepadded with 0s to fill the grid + (which ruins everything if you have the wrong number of rows). + 0 - No block + 1 - Red + 2 - Blue + 3 - Green + 4 - Yellow + Ideas for future colors, but not supported in this version: + 5 - Purple + 6 - Cyan + 7 - Gray + 8 - Black + 9 - White + */ + + width: 320 + height: 416 + color: "white" + //TODO: Theme support for both setting themes per level, and seeing it in the control! +} diff --git a/com.pelagicore.samegame/content/levels/TemplateBase.qmlc b/com.pelagicore.samegame/content/levels/TemplateBase.qmlc new file mode 100644 index 0000000..fbb2d44 Binary files /dev/null and b/com.pelagicore.samegame/content/levels/TemplateBase.qmlc differ diff --git a/com.pelagicore.samegame/content/levels/level0.qml b/com.pelagicore.samegame/content/levels/level0.qml new file mode 100644 index 0000000..a3cc06d --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level0.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + moveTarget: 3 + goalText: "1 of 10

Clear in three moves..." + startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , + 0 , 0 , 0 , 0 , 0 , 1 , 1 , 2 , 1 , 1 , + 0 , 0 , 0 , 1 , 1 , 3 , 3 , 3 , 3 , 3 , + 0 , 1 , 1 , 3 , 3 , 3 , 1 , 3 , 1 , 1 , + 1 , 2 , 3 , 3 , 1 , 1 , 3 , 3 , 3 , 3 , + 1 , 3 , 3 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , + 1 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ] +} diff --git a/com.pelagicore.samegame/content/levels/level1.qml b/com.pelagicore.samegame/content/levels/level1.qml new file mode 100644 index 0000000..b9457ae --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level1.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + timeTarget: 10 + goalText: "2 of 10

Clear in 10 seconds..." + startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , 2 , + 1 , 2 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , + 2 , 2 , 1 , 3 , 3 , 3 , 1 , 1 , 1 , 2 , + 2 , 1 , 1 , 1 , 3 , 3 , 3 , 1 , 2 , 2 , + 1 , 1 , 1 , 1 , 1 , 3 , 3 , 3 , 2 , 1 ] +} diff --git a/com.pelagicore.samegame/content/levels/level2.qml b/com.pelagicore.samegame/content/levels/level2.qml new file mode 100644 index 0000000..d7863ad --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level2.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + scoreTarget: 1200 + timeTarget: 60 + goalText: "3 of 10

Score over 1200 points in one minute..." + mustClear: false + startingGrid: [ 3 , 1 , 2 , 1 , 1 , 2 , 1 , 1 , 3 , 3 , + 1 , 3 , 3 , 2 , 3 , 3 , 1 , 1 , 3 , 1 , + 3 , 1 , 3 , 3 , 2 , 3 , 3 , 3 , 1 , 2 , + 3 , 2 , 2 , 1 , 3 , 3 , 2 , 1 , 1 , 2 , + 3 , 1 , 2 , 2 , 2 , 2 , 2 , 1 , 3 , 1 , + 2 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , 3 , 2 , + 3 , 2 , 1 , 1 , 3 , 3 , 3 , 2 , 2 , 1 , + 1 , 2 , 2 , 3 , 2 , 3 , 3 , 3 , 1 , 1 , + 1 , 3 , 3 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , + 3 , 3 , 2 , 1 , 2 , 2 , 1 , 1 , 1 , 3 , + 2 , 1 , 3 , 2 , 3 , 2 , 3 , 2 , 2 , 1 , + 1 , 3 , 1 , 2 , 1 , 2 , 3 , 1 , 2 , 2 , + 1 , 2 , 2 , 2 , 1 , 1 , 2 , 3 , 1 , 2 ] +} diff --git a/com.pelagicore.samegame/content/levels/level3.qml b/com.pelagicore.samegame/content/levels/level3.qml new file mode 100644 index 0000000..e9b9b15 --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level3.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + scoreTarget: 3000 + timeTarget: 60 + goalText: "4 of 10
Clear the board with over 3000 points in under a minute..." + startingGrid: [ 3 , 3 , 1 , 1 , 1 , 2 , 2 , 4 , 3 , 3 , + 4 , 3 , 1 , 4 , 2 , 2 , 2 , 4 , 3 , 4 , + 4 , 3 , 3 , 4 , 1 , 1 , 3 , 3 , 4 , 4 , + 3 , 3 , 3 , 3 , 3 , 1 , 3 , 2 , 2 , 4 , + 4 , 4 , 3 , 4 , 3 , 1 , 4 , 4 , 4 , 4 , + 4 , 4 , 3 , 4 , 1 , 1 , 4 , 4 , 3 , 3 , + 4 , 2 , 2 , 2 , 2 , 2 , 4 , 4 , 4 , 1 , + 4 , 4 , 2 , 4 , 2 , 2 , 1 , 1 , 1 , 1 , + 4 , 4 , 2 , 4 , 2 , 2 , 1 , 4 , 4 , 1 , + 4 , 1 , 1 , 4 , 3 , 3 , 4 , 2 , 4 , 1 , + 4 , 1 , 1 , 2 , 3 , 3 , 4 , 2 , 2 , 1 , + 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 2 , 1 , + 4 , 1 , 1 , 2 , 2 , 3 , 4 , 3 , 4 , 4 ] +} diff --git a/com.pelagicore.samegame/content/levels/level4.qml b/com.pelagicore.samegame/content/levels/level4.qml new file mode 100644 index 0000000..00e1d37 --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level4.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + goalText: "5 of 10

Clear the level..." + startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 3 , 2 , 1 , 1 , 1 , 1 , 3 , 2 , 3 , + 1 , 2 , 3 , 1 , 3 , 2 , 2 , 1 , 1 , 2 , + 3 , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 3 , 3 , + 2 , 1 , 1 , 3 , 2 , 1 , 1 , 2 , 1 , 3 , + 1 , 3 , 3 , 1 , 2 , 1 , 2 , 1 , 3 , 3 , + 1 , 3 , 2 , 2 , 2 , 1 , 1 , 3 , 2 , 3 , + 1 , 1 , 3 , 2 , 3 , 3 , 2 , 1 , 1 , 1 , + 1 , 2 , 2 , 3 , 2 , 2 , 1 , 3 , 1 , 3 ] +} diff --git a/com.pelagicore.samegame/content/levels/level5.qml b/com.pelagicore.samegame/content/levels/level5.qml new file mode 100644 index 0000000..0be3c9d --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level5.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + moveTarget: 4 + goalText: "6 of 10

Clear in four or less moves..." + startingGrid: [ 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , + 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , + 4 , 2 , 4 , 4 , 4 , 3 , 2 , 3 , 4 , 4 , + 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , + 4 , 4 , 4 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , + 4 , 2 , 2 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , + 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , + 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , + 4 , 3 , 3 , 3 , 4 , 2 , 4 , 4 , 4 , 3 , + 4 , 3 , 3 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , + 4 , 3 , 4 , 3 , 4 , 2 , 4 , 4 , 4 , 4 , + 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , + 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ] +} diff --git a/com.pelagicore.samegame/content/levels/level6.qml b/com.pelagicore.samegame/content/levels/level6.qml new file mode 100644 index 0000000..e496467 --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level6.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + moveTarget: 20 + timeTarget: 40 + goalText: "7 of 10

Clear with 20 moves in 40 seconds (or better)." + startingGrid: [ 1 , 3 , 1 , 1 , 1 , 1 , 2 , 1 , 2 , 2 , + 2 , 1 , 2 , 3 , 3 , 1 , 3 , 1 , 1 , 3 , + 3 , 1 , 1 , 1 , 2 , 2 , 3 , 2 , 3 , 1 , + 1 , 3 , 1 , 1 , 3 , 1 , 1 , 1 , 2 , 3 , + 2 , 1 , 1 , 1 , 3 , 2 , 3 , 3 , 2 , 3 , + 3 , 3 , 3 , 3 , 2 , 2 , 3 , 1 , 3 , 2 , + 2 , 2 , 3 , 2 , 2 , 3 , 2 , 2 , 2 , 2 , + 1 , 2 , 1 , 2 , 1 , 3 , 2 , 3 , 2 , 3 , + 1 , 1 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , 2 , + 3 , 3 , 2 , 2 , 2 , 2 , 3 , 1 , 3 , 1 , + 1 , 2 , 3 , 3 , 3 , 1 , 3 , 2 , 1 , 2 , + 1 , 2 , 1 , 1 , 2 , 3 , 1 , 2 , 1 , 3 , + 3 , 1 , 2 , 2 , 1 , 3 , 3 , 1 , 3 , 2 ] +} diff --git a/com.pelagicore.samegame/content/levels/level7.qml b/com.pelagicore.samegame/content/levels/level7.qml new file mode 100644 index 0000000..bf19057 --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level7.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + goalText: "8 of 10

Clear the grid." + startingGrid: [ 2 , 4 , 3 , 2 , 3 , 2 , 3 , 3 , 4 , 3 , + 2 , 2 , 3 , 3 , 1 , 4 , 3 , 3 , 3 , 2 , + 1 , 4 , 2 , 3 , 4 , 3 , 3 , 1 , 1 , 1 , + 2 , 1 , 2 , 4 , 4 , 2 , 2 , 3 , 2 , 1 , + 3 , 4 , 4 , 1 , 3 , 2 , 4 , 2 , 1 , 1 , + 2 , 2 , 3 , 1 , 2 , 4 , 1 , 2 , 1 , 2 , + 1 , 2 , 3 , 2 , 4 , 4 , 3 , 1 , 1 , 2 , + 4 , 4 , 2 , 1 , 2 , 4 , 2 , 2 , 4 , 3 , + 4 , 2 , 4 , 1 , 3 , 4 , 1 , 4 , 2 , 4 , + 4 , 3 , 4 , 1 , 4 , 3 , 1 , 3 , 1 , 1 , + 3 , 3 , 2 , 3 , 2 , 4 , 1 , 2 , 4 , 4 , + 3 , 4 , 2 , 2 , 4 , 3 , 4 , 1 , 3 , 2 , + 4 , 3 , 3 , 4 , 2 , 4 , 1 , 2 , 3 , 2 ] +} diff --git a/com.pelagicore.samegame/content/levels/level8.qml b/com.pelagicore.samegame/content/levels/level8.qml new file mode 100644 index 0000000..45163e0 --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level8.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + scoreTarget: 1000 + goalText: "9 of 10

Score over 1000 points" + startingGrid: [ 1 , 4 , 4 , 3 , 2 , 1 , 4 , 2 , 4 , 2 , + 2 , 3 , 4 , 4 , 1 , 1 , 1 , 4 , 4 , 4 , + 1 , 3 , 1 , 2 , 2 , 1 , 2 , 1 , 4 , 2 , + 4 , 3 , 4 , 2 , 1 , 4 , 1 , 2 , 2 , 3 , + 3 , 4 , 2 , 4 , 4 , 3 , 2 , 2 , 2 , 1 , + 4 , 4 , 3 , 2 , 4 , 4 , 2 , 1 , 1 , 1 , + 1 , 2 , 1 , 3 , 4 , 1 , 1 , 3 , 2 , 3 , + 3 , 4 , 2 , 2 , 1 , 3 , 2 , 2 , 4 , 2 , + 2 , 4 , 1 , 2 , 2 , 4 , 3 , 3 , 3 , 1 , + 1 , 2 , 2 , 4 , 1 , 2 , 2 , 3 , 3 , 3 , + 4 , 4 , 1 , 4 , 3 , 1 , 3 , 3 , 3 , 4 , + 1 , 2 , 4 , 1 , 2 , 1 , 1 , 4 , 2 , 1 , + 1 , 2 , 3 , 4 , 2 , 4 , 4 , 2 , 1 , 3 ] +} diff --git a/com.pelagicore.samegame/content/levels/level9.qml b/com.pelagicore.samegame/content/levels/level9.qml new file mode 100644 index 0000000..2498ca9 --- /dev/null +++ b/com.pelagicore.samegame/content/levels/level9.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +TemplateBase{ + scoreTarget: 2000 + timeTarget: 60 + moveTarget: 20 + mustClear: false + goalText: "10 of 10

Score 2000 in one minute with less than 20 moves!" + startingGrid: [ 3 , 2 , 3 , 1 , 3 , 3 , 4 , 1 , 3 , 3 , + 2 , 3 , 2 , 1 , 1 , 2 , 2 , 2 , 4 , 1 , + 2 , 4 , 4 , 4 , 3 , 1 , 4 , 4 , 4 , 1 , + 3 , 1 , 3 , 4 , 4 , 2 , 2 , 2 , 2 , 3 , + 2 , 1 , 4 , 4 , 3 , 3 , 1 , 1 , 3 , 2 , + 3 , 2 , 1 , 4 , 3 , 4 , 1 , 3 , 4 , 2 , + 3 , 3 , 1 , 4 , 4 , 4 , 2 , 1 , 2 , 3 , + 2 , 3 , 4 , 3 , 4 , 1 , 1 , 3 , 2 , 4 , + 4 , 4 , 1 , 2 , 4 , 3 , 2 , 2 , 2 , 4 , + 1 , 4 , 2 , 2 , 1 , 1 , 2 , 1 , 1 , 4 , + 1 , 4 , 3 , 3 , 3 , 1 , 3 , 4 , 4 , 2 , + 3 , 4 , 1 , 1 , 2 , 2 , 2 , 3 , 2 , 1 , + 3 , 3 , 4 , 3 , 1 , 1 , 1 , 4 , 4 , 3 ] +} diff --git a/com.pelagicore.samegame/content/qmldir b/com.pelagicore.samegame/content/qmldir new file mode 100644 index 0000000..3b552ec --- /dev/null +++ b/com.pelagicore.samegame/content/qmldir @@ -0,0 +1,13 @@ +singleton Settings 1.0 Settings.qml +Block 1.0 Block.qml +BlockEmitter 1.0 BlockEmitter.qml +Button 1.0 Button.qml +GameArea 1.0 GameArea.qml +LogoAnimation 1.0 LogoAnimation.qml +MenuEmitter 1.0 MenuEmitter.qml +PaintEmitter 1.0 PaintEmitter.qml +PrimaryPack 1.0 PrimaryPack.qml +PuzzleBlock 1.0 PuzzleBlock.qml +SamegameText 1.0 SamegameText.qml +SimpleBlock 1.0 SimpleBlock.qml +SmokeText 1.0 SmokeText.qml diff --git a/com.pelagicore.samegame/content/samegame.js b/com.pelagicore.samegame/content/samegame.js new file mode 100644 index 0000000..710ad3e --- /dev/null +++ b/com.pelagicore.samegame/content/samegame.js @@ -0,0 +1,582 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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$ +** +****************************************************************************/ + +/* This script file handles the game logic */ +.pragma library +.import QtQuick.LocalStorage 2.0 as Sql + +var maxColumn = 10; +var maxRow = 13; +var types = 3; +var maxIndex = maxColumn*maxRow; +var board = new Array(maxIndex); +var blockSrc = "Block.qml"; +var gameDuration; +var component = Qt.createComponent(blockSrc); +var gameCanvas; +var betweenTurns = false; + +var puzzleLevel = null; +var puzzlePath = ""; + +var gameMode = "arcade"; //Set in new game, then tweaks behavior of other functions +var gameOver = false; + +function changeBlock(src) +{ + blockSrc = src; + component = Qt.createComponent(blockSrc); +} + +// Index function used instead of a 2D array +function index(column, row) +{ + return column + row * maxColumn; +} + +function timeStr(msecs) +{ + var secs = Math.floor(msecs/1000); + var m = Math.floor(secs/60); + var ret = "" + m + "m " + (secs%60) + "s"; + return ret; +} + +function cleanUp() +{ + if (gameCanvas == undefined) + return; + // Delete blocks from previous game + for (var i = 0; i < maxIndex; i++) { + if (board[i] != null) + board[i].destroy(); + board[i] = null; + } + if (puzzleLevel != null){ + puzzleLevel.destroy(); + puzzleLevel = null; + } + gameCanvas.mode = "" +} + +function startNewGame(gc, mode, map) +{ + gameCanvas = gc; + if (mode == undefined) + gameMode = "arcade"; + else + gameMode = mode; + gameOver = false; + + cleanUp(); + + gc.gameOver = false; + gc.mode = gameMode; + // Calculate board size + maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize); + maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize); + maxIndex = maxRow * maxColumn; + if (gameMode == "arcade") //Needs to be after board sizing + getHighScore(); + + + // Initialize Board + board = new Array(maxIndex); + gameCanvas.score = 0; + gameCanvas.score2 = 0; + gameCanvas.moves = 0; + gameCanvas.curTurn = 1; + if (gameMode == "puzzle") + loadMap(map); + else//Note that we load them in reverse order for correct visual stacking + for (var column = maxColumn - 1; column >= 0; column--) + for (var row = maxRow - 1; row >= 0; row--) + createBlock(column, row); + if (gameMode == "puzzle") + getLevelHistory();//Needs to be after map load + gameDuration = new Date(); +} + +var fillFound; // Set after a floodFill call to the number of blocks found +var floodBoard; // Set to 1 if the floodFill reaches off that node + +// NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope +function handleClick(x,y) +{ + if (betweenTurns || gameOver || gameCanvas == undefined) + return; + var column = Math.floor(x/gameCanvas.blockSize); + var row = Math.floor(y/gameCanvas.blockSize); + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return; + if (board[index(column, row)] == null) + return; + // If it's a valid block, remove it and all connected (does nothing if it's not connected) + floodFill(column,row, -1); + if (fillFound <= 0) + return; + if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) + gameCanvas.score2 += (fillFound - 1) * (fillFound - 1); + else + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) + shuffleUp(); + else + shuffleDown(); + gameCanvas.moves += 1; + if (gameMode == "endless") + refill(); + else if (gameMode != "multiplayer") + victoryCheck(); + if (gameMode == "multiplayer" && !gc.gameOver){ + betweenTurns = true; + gameCanvas.swapPlayers();//signal, animate and call turnChange() when ready + } +} + +function floodFill(column,row,type) +{ + if (board[index(column, row)] == null) + return; + var first = false; + if (type == -1) { + first = true; + type = board[index(column,row)].type; + + // Flood fill initialization + fillFound = 0; + floodBoard = new Array(maxIndex); + } + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return; + if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) + return; + floodBoard[index(column, row)] = 1; + floodFill(column + 1, row, type); + floodFill(column - 1, row, type); + floodFill(column, row + 1, type); + floodFill(column, row - 1, type); + if (first == true && fillFound == 0) + return; // Can't remove single blocks + board[index(column, row)].dying = true; + board[index(column, row)] = null; + fillFound += 1; +} + +function shuffleDown() +{ + // Fall down + for (var column = 0; column < maxColumn; column++) { + var fallDist = 0; + for (var row = maxRow - 1; row >= 0; row--) { + if (board[index(column,row)] == null) { + fallDist += 1; + } else { + if (fallDist > 0) { + var obj = board[index(column, row)]; + obj.y = (row + fallDist) * gameCanvas.blockSize; + board[index(column, row + fallDist)] = obj; + board[index(column, row)] = null; + } + } + } + } + // Fall to the left + fallDist = 0; + for (column = 0; column < maxColumn; column++) { + if (board[index(column, maxRow - 1)] == null) { + fallDist += 1; + } else { + if (fallDist > 0) { + for (row = 0; row < maxRow; row++) { + obj = board[index(column, row)]; + if (obj == null) + continue; + obj.x = (column - fallDist) * gameCanvas.blockSize; + board[index(column - fallDist,row)] = obj; + board[index(column, row)] = null; + } + } + } + } +} + + +function shuffleUp() +{ + // Fall up + for (var column = 0; column < maxColumn; column++) { + var fallDist = 0; + for (var row = 0; row < maxRow; row++) { + if (board[index(column,row)] == null) { + fallDist += 1; + } else { + if (fallDist > 0) { + var obj = board[index(column, row)]; + obj.y = (row - fallDist) * gameCanvas.blockSize; + board[index(column, row - fallDist)] = obj; + board[index(column, row)] = null; + } + } + } + } + // Fall to the left (or should it be right, so as to be left for P2?) + fallDist = 0; + for (column = 0; column < maxColumn; column++) { + if (board[index(column, 0)] == null) { + fallDist += 1; + } else { + if (fallDist > 0) { + for (row = 0; row < maxRow; row++) { + obj = board[index(column, row)]; + if (obj == null) + continue; + obj.x = (column - fallDist) * gameCanvas.blockSize; + board[index(column - fallDist,row)] = obj; + board[index(column, row)] = null; + } + } + } + } +} + +function turnChange()//called by ui outside +{ + betweenTurns = false; + if (gameCanvas.curTurn == 1){ + shuffleUp(); + gameCanvas.curTurn = 2; + victoryCheck(); + }else{ + shuffleDown(); + gameCanvas.curTurn = 1; + victoryCheck(); + } +} + +function refill() +{ + for (var column = 0; column < maxColumn; column++) { + for (var row = 0; row < maxRow; row++) { + if (board[index(column, row)] == null) + createBlock(column, row); + } + } +} + +function victoryCheck() +{ + // Awards bonuses for no blocks left + var deservesBonus = true; + if (board[index(0,maxRow - 1)] != null || board[index(0,0)] != null) + deservesBonus = false; + // Checks for game over + if (deservesBonus){ + if (gameCanvas.curTurn = 1) + gameCanvas.score += 1000; + else + gameCanvas.score2 += 1000; + } + gameOver = deservesBonus; + if (gameCanvas.curTurn == 1){ + if (!(floodMoveCheck(0, maxRow - 1, -1))) + gameOver = true; + }else{ + if (!(floodMoveCheck(0, 0, -1, true))) + gameOver = true; + } + if (gameMode == "puzzle"){ + puzzleVictoryCheck(deservesBonus);//Takes it from here + return; + } + if (gameOver) { + var winnerScore = Math.max(gameCanvas.score, gameCanvas.score2); + if (gameMode == "multiplayer"){ + gameCanvas.score = winnerScore; + saveHighScore(gameCanvas.score2); + } + saveHighScore(gameCanvas.score); + gameDuration = new Date() - gameDuration; + gameCanvas.gameOver = true; + } +} + +// Only floods up and right, to see if it can find adjacent same-typed blocks +function floodMoveCheck(column, row, type, goDownInstead) +{ + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return false; + if (board[index(column, row)] == null) + return false; + var myType = board[index(column, row)].type; + if (type == myType) + return true; + if (goDownInstead) + return floodMoveCheck(column + 1, row, myType, goDownInstead) || + floodMoveCheck(column, row + 1, myType, goDownInstead); + else + return floodMoveCheck(column + 1, row, myType) || + floodMoveCheck(column, row - 1, myType); +} + +function createBlock(column,row,type) +{ + // Note that we don't wait for the component to become ready. This will + // only work if the block QML is a local file. Otherwise the component will + // not be ready immediately. There is a statusChanged signal on the + // component you could use if you want to wait to load remote files. + if (component.status == 1){ + if (type == undefined) + type = Math.floor(Math.random() * types); + if (type < 0 || type > 4) { + console.log("Invalid type requested");//TODO: Is this triggered by custom levels much? + return; + } + var dynamicObject = component.createObject(gameCanvas, + {"type": type, + "x": column*gameCanvas.blockSize, + "y": -1*gameCanvas.blockSize, + "width": gameCanvas.blockSize, + "height": gameCanvas.blockSize, + "particleSystem": gameCanvas.ps}); + if (dynamicObject == null){ + console.log("error creating block"); + console.log(component.errorString()); + return false; + } + dynamicObject.y = row*gameCanvas.blockSize; + dynamicObject.spawned = true; + + board[index(column,row)] = dynamicObject; + }else{ + console.log("error loading block component"); + console.log(component.errorString()); + return false; + } + return true; +} + +function showPuzzleError(str) +{ + //TODO: Nice user visible UI? + console.log(str); +} + +function loadMap(map) +{ + puzzlePath = map; + var levelComp = Qt.createComponent(puzzlePath); + if (levelComp.status != 1){ + console.log("Error loading level"); + showPuzzleError(levelComp.errorString()); + return; + } + puzzleLevel = levelComp.createObject(); + if (puzzleLevel == null || !puzzleLevel.startingGrid instanceof Array) { + showPuzzleError("Bugger!"); + return; + } + gameCanvas.showPuzzleGoal(puzzleLevel.goalText); + // showPuzzleGoal should call finishLoadingMap as the next thing it does, + // before handling more events +} + +function finishLoadingMap() +{ + for (var i in puzzleLevel.startingGrid) + if (! (puzzleLevel.startingGrid[i] >= 0 && puzzleLevel.startingGrid[i] <= 9) ) + puzzleLevel.startingGrid[i] = 0; + //TODO: Don't allow loading larger levels, leads to cheating + while (puzzleLevel.startingGrid.length > maxIndex) puzzleLevel.startingGrid.shift(); + while (puzzleLevel.startingGrid.length < maxIndex) puzzleLevel.startingGrid.unshift(0); + for (var i in puzzleLevel.startingGrid) + if (puzzleLevel.startingGrid[i] > 0) + createBlock(i % maxColumn, Math.floor(i / maxColumn), puzzleLevel.startingGrid[i] - 1); + + //### Experimental feature - allow levels to contain arbitrary QML scenes as well! + //while (puzzleLevel.children.length) + // puzzleLevel.children[0].parent = gameCanvas; + gameDuration = new Date(); //Don't start until we finish loading +} + +function puzzleVictoryCheck(clearedAll)//gameOver has also been set if no more moves +{ + var won = true; + var soFar = new Date() - gameDuration; + if (puzzleLevel.scoreTarget != -1 && gameCanvas.score < puzzleLevel.scoreTarget){ + won = false; + } if (puzzleLevel.scoreTarget != -1 + && gameCanvas.score >= puzzleLevel.scoreTarget && !puzzleLevel.mustClear){ + gameOver = true; + } if (puzzleLevel.timeTarget != -1 && soFar/1000.0 > puzzleLevel.timeTarget){ + gameOver = true; + } if (puzzleLevel.moveTarget != -1 && gameCanvas.moves >= puzzleLevel.moveTarget){ + gameOver = true; + } if (puzzleLevel.mustClear && gameOver && !clearedAll) { + won = false; + } + + if (gameOver) { + gameCanvas.gameOver = true; + gameCanvas.showPuzzleEnd(won); + + if (won) { + // Store progress + saveLevelHistory(); + } + } +} + +function getHighScore() +{ + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + // Only show results for the current grid size + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "' + + maxColumn + "x" + maxRow + '" AND game = "' + gameMode + '" ORDER BY score desc'); + if (rs.rows.length > 0) + gameCanvas.highScore = rs.rows.item(0).score; + else + gameCanvas.highScore = 0; + } + ); +} + +function saveHighScore(score) +{ + // Offline storage + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; + var data = [ + gameMode, + score, + maxColumn + "x" + maxRow, + Math.floor(gameDuration / 1000) + ]; + if (score >= gameCanvas.highScore)//Update UI field + gameCanvas.highScore = score; + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + tx.executeSql(dataStr, data); + } + ); +} + +function getLevelHistory() +{ + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); + var rs = tx.executeSql('SELECT * FROM Puzzle WHERE level = "' + puzzlePath + '" ORDER BY score desc'); + if (rs.rows.length > 0) { + gameCanvas.puzzleWon = true; + gameCanvas.highScore = rs.rows.item(0).score; + } else { + gameCanvas.puzzleWon = false; + gameCanvas.highScore = 0; + } + } + ); +} + +function saveLevelHistory() +{ + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + var dataStr = "INSERT INTO Puzzle VALUES(?, ?, ?, ?)"; + var data = [ + puzzlePath, + gameCanvas.score, + gameCanvas.moves, + Math.floor(gameDuration / 1000) + ]; + gameCanvas.puzzleWon = true; + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); + tx.executeSql(dataStr, data); + } + ); +} + +function nuke() //For "Debug mode" +{ + for (var row = 1; row <= 5; row++) { + for (var col = 0; col < 5; col++) { + if (board[index(col, maxRow - row)] != null) { + board[index(col, maxRow - row)].dying = true; + board[index(col, maxRow - row)] = null; + } + } + } + if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) + shuffleUp(); + else + shuffleDown(); + if (gameMode == "endless") + refill(); + else + victoryCheck(); +} diff --git a/com.pelagicore.samegame/content/samegame.jsc b/com.pelagicore.samegame/content/samegame.jsc new file mode 100644 index 0000000..8e43d95 Binary files /dev/null and b/com.pelagicore.samegame/content/samegame.jsc differ diff --git a/com.pelagicore.samegame/icon.png b/com.pelagicore.samegame/icon.png new file mode 100644 index 0000000..83457ce Binary files /dev/null and b/com.pelagicore.samegame/icon.png differ diff --git a/com.pelagicore.samegame/info.yaml b/com.pelagicore.samegame/info.yaml new file mode 100644 index 0000000..fab45ea --- /dev/null +++ b/com.pelagicore.samegame/info.yaml @@ -0,0 +1,17 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'com.pelagicore.samegame' +icon: 'icon.png' +code: 'Main.qml' +runtime: 'qml' +name: + en: 'Same Game' + de: 'Spiel' + cs: 'Hra' + ru: 'Игра' + zh: '游戏' + ja: 'ゲーム' + ko: '경기' + +categories: [ 'game' ] diff --git a/qt-auto-extra-apps.pro b/qt-auto-extra-apps.pro index 08a8a16..2c46d57 100644 --- a/qt-auto-extra-apps.pro +++ b/qt-auto-extra-apps.pro @@ -5,6 +5,7 @@ SUBDIRS = com.pelagicore.camera \ com.luxoft.webbrowser \ com.luxoft.videoplayer \ com.luxoft.greenomics \ + com.pelagicore.samegame \ com.pelagicore.webradio \ # Top-level package target -- cgit v1.2.3