diff --git a/src/activities/activities.txt b/src/activities/activities.txt index f3d17f4fc..effcd33e0 100644 --- a/src/activities/activities.txt +++ b/src/activities/activities.txt @@ -1,122 +1,123 @@ # The list of activities that will be loaded at GCompris start. # Keep it sorted advanced_colors algebra_by algebra_div algebra_minus algebra_plus algorithm align4 align4-2players alphabet-sequence babymatch babyshapes baby_wordprocessor balancebox ballcatch braille_alphabets braille_fun canal_lock chess chess_2players chess_partyend chronos clickanddraw clickgame click_on_letter click_on_letter_up clockgame color_mix color_mix_light colors details drawnumber enumerate erase erase_2clic erase_clic explore_farm_animals explore_monuments explore_world_animals explore_world_music fifteen followline football geo-country geography gletters gnumch-equality gnumch-factors gnumch-inequality gnumch-multiples gnumch-primes graph-coloring guessnumber hangman hanoi hanoi_real hexagon imagename instruments intro_gravity lang leftright lightsoff louis-braille magic-hat-minus magic-hat-plus maze mazeinvisible mazerelative melody memory memory-enumerate memory-math-add memory-math-add-minus memory-math-add-minus-mult-div memory-math-add-minus-mult-div-tux memory-math-add-minus-tux memory-math-add-tux memory-math-div memory-math-div-tux memory-math-minus memory-math-minus-tux memory-math-mult memory-math-mult-div memory-math-mult-div-tux memory-math-mult-tux memory-sound memory-sound-tux memory-tux memory-wordnumber mining missing-letter money money_back money_back_cents money_cents mosaic numbers-odd-even paintings +parachute penalty planegame readingh readingv redraw redraw_symmetrical renewable_energy reversecount scalesboard scalesboard_weight scalesboard_weight_avoirdupois simplepaint smallnumbers smallnumbers2 sudoku superbrain target tic_tac_toe tic_tac_toe_2players traffic watercycle wordsgame diff --git a/src/activities/parachute/ActivityInfo.qml b/src/activities/parachute/ActivityInfo.qml new file mode 100644 index 000000000..81655e8ae --- /dev/null +++ b/src/activities/parachute/ActivityInfo.qml @@ -0,0 +1,33 @@ +/* GCompris - ActivityInfo.qml + * + * Copyright (C) 2015 Rajdeep Kaur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +ActivityInfo { + name: "parachute/Parachute.qml" + difficulty: 1 + icon: "parachute/parachute.svg" + author: "Rajdeep Kaur <rajdeep51994@gmail.com>" + demo: true + title: qsTr("Parachute activity") + description: qsTr("Help Tux the parachutist land safely") + //intro: "put here in comment the text for the intro voice" + goal:qsTr("In this game, Tux the parachutist needs help to land safely on the fishing boat. He needs to allow for the wind direction and speed.") + prerequisite:qsTr("This board is game-oriented. No specific skills are needed to play.") + manual:qsTr("Hit any key or click on the plane to make Tux jump. Hit another key or click on Tux to open the parachute.") + section:"fun" +} diff --git a/src/activities/parachute/CMakeLists.txt b/src/activities/parachute/CMakeLists.txt new file mode 100644 index 000000000..e072e583e --- /dev/null +++ b/src/activities/parachute/CMakeLists.txt @@ -0,0 +1 @@ +GCOMPRIS_ADD_RCC(activities/parachute *.qml *.svg *.js resource/*) diff --git a/src/activities/parachute/Parachute.qml b/src/activities/parachute/Parachute.qml new file mode 100644 index 000000000..6d5ba41b7 --- /dev/null +++ b/src/activities/parachute/Parachute.qml @@ -0,0 +1,409 @@ +/* GCompris - parachute.qml + * + * Copyright (C) 2015 Rajdeep Kaur + * + * Authors: + * Bruno Coudoin (GTK+ version) + * Rajdeep kaur (Qt Quick port) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.1 +import GCompris 1.0 +import QtGraphicalEffects 1.0 +import "../../core" +import "qrc:/gcompris/src/core/core.js" as Core +import "parachute.js" as Activity + +ActivityBase { + id: activity + + property string dataSetUrl: "qrc:/gcompris/src/activities/parachute/resource/" + + onStart: focus = true + onStop: {} + + Keys.onPressed: Activity.processPressedKey(event) + Keys.onReleased: Activity.processReleasedKey(event) + + pageComponent: Image { + + id: background + source:activity.dataSetUrl + "back.svg" + fillMode: Image.PreserveAspectCrop + sourceSize.width: parent.width + anchors.fill: parent + + signal start + signal stop + + Component.onCompleted: { + activity.start.connect(start) + activity.stop.connect(stop) + } + + onStart: { } + onStop: { Activity.stop() } + + // Add here the QML items you need to access in javascript + QtObject { + id: items + property Item main : activity.main + property alias background: background + property alias animationheli: animationheli + property alias animationcloud: animationcloud + property alias bar: bar + property alias bonus: bonus + property alias helicopter: helicopter + property alias animationboat: animationboat + property alias keyunable: keyunable + property alias ok: ok + property alias loop: loop + property alias loopcloud: loopcloud + property alias tuxX: tuxX + property alias tuxY: tuxY + property alias tux: tux + property alias tuximage: tuximage + property alias onPressdown: onPressdown + property alias onPressUp: onPressUp + property alias onReleas: onReleas + property alias helimotion: helimotion + } + + IntroMessage { + id:message + onIntroDone: { + Activity.start(items) + + } + intro: [ + qsTr("The red boat moves in the water from left to right."), + qsTr("Penguin Tux falls off from the plane, to land on the boat safely. "), + qsTr("The purpose of the game is to determine the exact time when" + + "he should fall off from the plane, in order to safely get to the boat. "), + qsTr("Tux also carries a parachute, that lets him prevent free fall under gravity, that is dangerous." + +"Tux falls off when the player left clicks on the plane."), + qsTr("His speed can be controlled by the player by pressing UP and DOWN arrow keys," + + "such that Tux is saved from falling in water. "), + qsTr("Help Tux save his life!") + ] + z: 20 + anchors { + top: parent.top + topMargin: 10 + right: parent.right + rightMargin: 5 + left: parent.left + leftMargin: 5 + } + } + + GCText { + id:keyunable + anchors.centerIn: parent + fontSize: largeSize + visible:false + text:qsTr("Control fall speed with up and down arrow keys") + } + + + Item{ + id:helimotion + width:(bar.level===1?background.width/6:bar.level===2?background.width/4:bar.level===3?background.width/11:bar.level===4?background.width/7:background.width/7) + height:(bar.level===1?background.height/6:bar.level===2?background.height/4:bar.level===3?background.height/11:bar.level===4?background.height/7:background.height/7) + x: -width + Rectangle{ + id:forhover + width:(bar.level===1?background.width/6:bar.level===2?background.width/4:bar.level===3?background.width/11:bar.level===4?background.width/7:background.width/7) + height:(bar.level===1?background.height/6:bar.level===2?background.height/4:bar.level===3?background.height/11:bar.level===4?background.height/7:background.height/7) + visible:false + border.width:7 + radius:20 + border.color:"#A80000" + color:"#500000" + } + Image{ + id:helicopter + source:activity.dataSetUrl+"tuxplane.svg" + width:(bar.level===1?background.width/6:bar.level===2?background.width/4:bar.level===3?background.width/11:bar.level===4?background.width/7:background.width/7) + height:(bar.level===1?background.height/6:bar.level===2?background.height/4:bar.level===3?background.height/11:bar.level===4?background.height/7:background.height/7) + MouseArea { + id:mousei + hoverEnabled: true + anchors.fill:parent + onEntered:{ + forhover.visible=true + } + onExited:{ + forhover.visible=false + } + onClicked:{ + if(Activity.Oneclick === false) { + tuximage.visible=true + tuxX.stop() + tuxY.start() + Activity.tuxImageStatus=1 + Activity.Oneclick = true; + } + } + + } + } + SequentialAnimation{ + id:loop + loops: Animation.Infinite + PropertyAnimation { + id:animationheli + target:helimotion + properties: "x" + from:-helimotion.width + to:background.width + duration: (bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + easing.type:Easing.Linear + } + + + + } + } + + + Item { + id:tux + width:tuximage.width + height:tuximage.height + x:-helimotion.width + Image { + id: tuximage + source: activity.dataSetUrl+Activity.minitux + visible:false + MouseArea{ + id:tuxmouse + anchors.fill:parent + onClicked:{ + if(Activity.tuxImageStatus === 1) { + keyunable.visible = true + tuximage.source = activity.dataSetUrl+Activity.parachutetux + Activity.tuxImageStatus = 2 + + } + } + } + } + onYChanged: { + if(tux.y>background.height/1.5 && Activity.tuxImageStatus === 1 ) { + activity.audioEffects.play(activity.dataSetUrl+"bubble.wav" ) + Activity.tuxImageStatus=0 + Activity.onLose() + } + if((tux.y>background.height/1.5 && Activity.tuxImageStatus === 2) && ((tux.x>boatmotion.x) && (tux.xbackground.height/1.5 && Activity.tuxImageStatus === 2) && ((tux.xboatmotion.x+boatmotion.width))){ + Activity.tuxImageStatus = 0 + Activity.onLose() + } + + } + SequentialAnimation{ + id:tuxX + loops: Animation.Infinite + PropertyAnimation{ + target:tux + properties: "x" + from:-helimotion.width + to:background.width + duration:(bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + } + } + + PropertyAnimation{ + id:onPressdown + target:tux + from:Activity.ycheck === false?tuxY.y :tux.y + properties:"y" + duration:2000 + easing.type:Easing.Linear + to:background.height/1.3 + } + + PropertyAnimation{ + id:onPressUp + target:tux + from:Activity.ycheck === false?tuxY.y :tux.y + duration:80000 + properties:"y" + easing.type:Easing.InQuad + to:background.height/1.3 + } + + PropertyAnimation{ + id:onReleas + target:tux + from:tux.y + properties:"y" + duration:(bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + easing.type:Easing.Linear + to:background.height/1.3 + } + + + PropertyAnimation{ + id:tuxY + target:tux + properties: "x,y" + from:tuxX.y + to:background.height/1.3 + easing.type:Easing.OutQuad + duration:(bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + } + + + + + + + } + + Item{ + id:cloudmotion + width:cloud.width + height:height.height + Image{ + id:cloud + source:activity.dataSetUrl+"cloud.svg" + y:background.height/7 + } + SequentialAnimation{ + id:loopcloud + loops: Animation.Infinite + PropertyAnimation { + id:animationcloud + target:cloudmotion + properties:"x" + from:Math.random() > 0.2 ? background.width : -cloud.width + to:animationcloud.from === background.width ? -cloud.width : background.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + PropertyAnimation { + id:animationcloud1 + target:cloudmotion + properties:"x" + from:background.width + to:-cloud.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + PropertyAnimation { + id:animationcloud2 + target:cloudmotion + properties:"x" + from:-cloud.width + to:background.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + PropertyAnimation { + id:animationcloud3 + target:cloudmotion + properties:"x" + from:background.width + to:-cloud.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + + PropertyAnimation { + id:animationcloud4 + target:cloudmotion + properties:"x" + from:-cloud.width + to:background.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + + + } + } + + + Item{ + id:boatmotion + width:background.width/4 + height:background.height/4 + Image{ + id:boat + source:activity.dataSetUrl+"fishingboat.svg" + y:(bar.level === 1 ? background.height/1.4 : bar.level==2 ? background.height/1.4 : bar.level ===3 ? background.height/1.4:bar.level === 4?background.height/1.4:background.height/1.3 ) + width:(bar.level === 1 ? background.width/4 : bar.level==2 ? background.width/4.5 : bar.level ===3 ? background.width/5:bar.level === 4?background.width/5.1:background.width/5.1 ) + height:background.height/4 + + } + PropertyAnimation { + id:animationboat + target:boatmotion + properties:"x" + from:-boat.width + to:background.width-2.5*boat.width + duration:(bar.level === 1 ? 24000 : bar.level === 2 ? 20500 : bar.level === 3 ? 19000 : bar.level === 4 ? 17000 : 9000) + easing.type:Easing.Linear + } + } + + + + + DialogHelp { + id: dialogHelp + onClose: home() + } + + Bar { + id: bar + content: BarEnumContent { value: help | home | level } + onHelpClicked: { + displayDialog(dialogHelp) + } + onPreviousLevelClicked: Activity.previousLevel() + onNextLevelClicked: Activity.nextLevel() + onHomeClicked: activity.home() + } + + BarButton { + id: ok + source: "qrc:/gcompris/src/core/resource/bar_ok.svg"; + sourceSize.width: 75 * ApplicationInfo.ratio + visible: false + anchors.right: background.right + onClicked: { + Activity.loseflag = true + Activity.nextLevel() + + + } + } + + Bonus { + id: bonus + onWin:ok.visible = true + + } + + + } + +} + diff --git a/src/activities/parachute/Parachute.qml.autosave b/src/activities/parachute/Parachute.qml.autosave new file mode 100644 index 000000000..80a2fe576 --- /dev/null +++ b/src/activities/parachute/Parachute.qml.autosave @@ -0,0 +1,404 @@ +/* GCompris - parachute.qml + * + * Copyright (C) 2015 Rajdeep Kaur + * + * Authors: + * Bruno Coudoin (GTK+ version) + * Rajdeep kaur (Qt Quick port) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import QtQuick 2.1 +import GCompris 1.0 +import QtGraphicalEffects 1.0 +import "../../core" +import "qrc:/gcompris/src/core/core.js" as Core +import "parachute.js" as Activity + +ActivityBase { + id: activity + + property string dataSetUrl: "qrc:/gcompris/src/activities/parachute/resource/" + + onStart: focus = true + onStop: {} + + Keys.onPressed: Activity.processPressedKey(event) + Keys.onReleased: Activity.processReleasedKey(event) + + pageComponent: Image { + + id: background + source:activity.dataSetUrl + "back.svg" + fillMode: Image.PreserveAspectCrop + sourceSize.width: parent.width + anchors.fill: parent + + signal start + signal stop + + Component.onCompleted: { + activity.start.connect(start) + activity.stop.connect(stop) + } + + onStart: { } + onStop: { Activity.stop() } + + // Add here the QML items you need to access in javascript + QtObject { + id: items + property Item main : activity.main + property alias background: background + property alias animationheli: animationheli + property alias animationcloud: animationcloud + property alias bar: bar + property alias bonus: bonus + property alias helicopter: helicopter + property alias animationboat: animationboat + property alias keyunable: keyunable + property alias ok: ok + property alias loop: loop + property alias loopcloud: loopcloud + property alias tuxX: tuxX + property alias tuxY: tuxY + property alias tux: tux + property alias tuximage: tuximage + property alias onPressdown: onPressdown + property alias onPressUp: onPressUp + property alias onReleas: onReleas + property alias helimotion: helimotion + } + + IntroMessage { + id:message + onIntroDone: { + Activity.start(items) + + } + intro: [ + qsTr("The red boat moves in the water from left to right."), + qsTr("Penguin Tux falls off from the plane, to land on the boat safely. "), + qsTr("The purpose of the game is to determine the exact time when" + + "he should fall off from the plane, in order to safely get to the boat. "), + qsTr("Tux also carries a parachute, that lets him prevent free fall under gravity, that is dangerous." + +"Tux falls off when the player left clicks on the plane."), + qsTr("His speed can be controlled by the player by pressing UP and DOWN arrow keys," + + "such that Tux is saved from falling in water. "), + qsTr("Help Tux save his life!") + ] + z: 20 + anchors { + top: parent.top + topMargin: 10 + right: parent.right + rightMargin: 5 + left: parent.left + leftMargin: 5 + } + } + + GCText { + id:keyunable + anchors.centerIn: parent + fontSize: largeSize + visible:false + text:qsTr("Control fall speed with up and down arrow keys") + } + + + Item{ + id:helimotion + width:(bar.level===1?background.width/6:bar.level===2?background.width/4:bar.level===3?background.width/11:bar.level===4?background.width/7:background.width/7) + height:(bar.level===1?background.height/6:bar.level===2?background.height/4:bar.level===3?background.height/11:bar.level===4?background.height/7:background.height/7) + x: -width + Rectangle{ + id:forhover + width:(bar.level===1?background.width/6:bar.level===2?background.width/4:bar.level===3?background.width/11:bar.level===4?background.width/7:background.width/7) + height:(bar.level===1?background.height/6:bar.level===2?background.height/4:bar.level===3?background.height/11:bar.level===4?background.height/7:background.height/7) + visible:false + border.width:7 + radius:20 + border.color:"#A80000" + color:"#500000" + } + Image{ + id:helicopter + source:activity.dataSetUrl+"tuxplane.svg" + width:(bar.level===1?background.width/6:bar.level===2?background.width/4:bar.level===3?background.width/11:bar.level===4?background.width/7:background.width/7) + height:(bar.level===1?background.height/6:bar.level===2?background.height/4:bar.level===3?background.height/11:bar.level===4?background.height/7:background.height/7) + MouseArea { + id:mousei + hoverEnabled: true + anchors.fill:parent + onEntered:{ + forhover.visible=true + } + onExited:{ + forhover.visible=false + } + onClicked:{ + if(Activity.Oneclick === false) { + tuximage.visible=true + tuxX.stop() + tuxY.start() + Activity.tuxImageStatus=1 + Activity.Oneclick = true; + } + } + + } + } + SequentialAnimation{ + id:loop + loops: Animation.Infinite + PropertyAnimation { + id:animationheli + target:helimotion + properties: "x" + from:-helimotion.width + to:background.width + duration: (bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + easing.type:Easing.Linear + } + + + + } + } + + + Item { + id:tux + width:tuximage.width + height:tuximage.height + x:-helimotion.width + Image { + id: tuximage + source: activity.dataSetUrl+Activity.minitux + visible:false + MouseArea{ + id:tuxmouse + anchors.fill:parent + onClicked:{ + if(Activity.tuxImageStatus === 1) { + keyunable.visible = true + tuximage.source = activity.dataSetUrl+Activity.parachutetux + Activity.tuxImageStatus = 2 + + } + } + } + } + onYChanged: { + if(tux.y>background.height/1.5 && Activity.tuxImageStatus === 1 ) { + activity.audioEffects.play(activity.dataSetUrl+"bubble.wav" ) + Activity.tuxImageStatus=0 + Activity.onLose() + } + if((tux.y>background.height/1.5 && Activity.tuxImageStatus === 2) && ((tux.x>boatmotion.x) && (tux.xbackground.height/1.5 && Activity.tuxImageStatus === 2) && ((tux.xboatmotion.x+boatmotion.width))){ + Activity.tuxImageStatus = 0 + Activity.onLose() + } + + } + SequentialAnimation{ + id:tuxX + loops: Animation.Infinite + PropertyAnimation{ + target:tux + properties: "x" + from:-helimotion.width + to:background.width + duration:(bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + } + } + + PropertyAnimation{ + id:onPressdown + target:tux + from:Activity.ycheck === false?tuxY.y :tux.y + properties:"y" + duration:2000 + easing.type:Easing.Linear + to:background.height/1.3 + } + + PropertyAnimation{ + id:onPressUp + target:tux + from:Activity.ycheck === false?tuxY.y :tux.y + duration:80000 + properties:"y" + easing.type:Easing.InQuad + to:background.height/1.3 + } + + PropertyAnimation{ + id:onReleas + target:tux + from:tux.y + properties:"y" + duration:(bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + easing.type:Easing.Linear + to:background.height/1.3 + } + + + PropertyAnimation{ + id:tuxY + target:tux + properties: "x,y" + from:tuxX.y + to:background.height/1.3 + easing.type:Easing.OutQuad + duration:(bar.level === 1 ? 20000 : bar.level === 2 ? 16000 : bar.level === 3 ? 12000 : bar.level === 4 ? 10000 : 9000) + } + + } + + Item{ + id:cloudmotion + width:cloud.width + height:height.height + Image{ + id:cloud + source:activity.dataSetUrl+"cloud.svg" + y:background.height/7 + } + SequentialAnimation{ + id:loopcloud + loops: Animation.Infinite + PropertyAnimation { + id:animationcloud + target:cloudmotion + properties:"x" + from:Math.random() > 0.2 ? background.width : -cloud.width + to:animationcloud.from === background.width ? -cloud.width : background.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + PropertyAnimation { + id:animationcloud1 + target:cloudmotion + properties:"x" + from:background.width + to:-cloud.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + PropertyAnimation { + id:animationcloud2 + target:cloudmotion + properties:"x" + from:-cloud.width + to:background.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + PropertyAnimation { + id:animationcloud3 + target:cloudmotion + properties:"x" + from:background.width + to:-cloud.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + + PropertyAnimation { + id:animationcloud4 + target:cloudmotion + properties:"x" + from:-cloud.width + to:background.width + duration:(bar.level === 1 ? 19000 : bar.level === 2 ? 15000 : bar.level === 3 ? 11000 : bar.level === 4 ? 9000 : 9000) + easing.type:Easing.Linear + } + + + } + } + + + Item{ + id:boatmotion + width:background.width/4 + height:background.height/4 + Image{ + id:boat + source:activity.dataSetUrl+"fishingboat.svg" + y:(bar.level === 1 ? background.height/1.4 : bar.level==2 ? background.height/1.4 : bar.level ===3 ? background.height/1.4:bar.level === 4?background.height/1.4:background.height/1.3 ) + width:(bar.level === 1 ? background.width/4 : bar.level==2 ? background.width/4.5 : bar.level ===3 ? background.width/5:bar.level === 4?background.width/5.1:background.width/5.1 ) + height:background.height/4 + + } + PropertyAnimation { + id:animationboat + target:boatmotion + properties:"x" + from:-boat.width + to:background.width-2.5*boat.width + duration:(bar.level === 1 ? 24000 : bar.level === 2 ? 20500 : bar.level === 3 ? 19000 : bar.level === 4 ? 17000 : 9000) + easing.type:Easing.Linear + } + } + + + + + DialogHelp { + id: dialogHelp + onClose: home() + } + + Bar { + id: bar + content: BarEnumContent { value: help | home | level } + onHelpClicked: { + displayDialog(dialogHelp) + } + onPreviousLevelClicked: Activity.previousLevel() + onNextLevelClicked: Activity.nextLevel() + onHomeClicked: activity.home() + } + + BarButton { + id: ok + source: "qrc:/gcompris/src/core/resource/bar_ok.svg"; + sourceSize.width: 75 * ApplicationInfo.ratio + visible: false + anchors.right: background.right + onClicked: { + Activity.loseflag = true + Activity.nextLevel() + + + } + } + + Bonus { + id: bonus + onWin:ok.visible = true + + } + + + } + +} + diff --git a/src/activities/parachute/parachute.js b/src/activities/parachute/parachute.js new file mode 100644 index 000000000..9d87b7635 --- /dev/null +++ b/src/activities/parachute/parachute.js @@ -0,0 +1,218 @@ +/* GCompris - parachute.js + * + * Copyright (C) 2015 Rajdeep Kaur + * + * Authors: + * Bruno Coudoin (GTK+ version) + * Rajdeep kaur (Qt Quick port) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +.pragma library +.import QtQuick 2.0 as Quick +.import GCompris 1.0 as GCompris +.import "qrc:/gcompris/src/core/core.js" as Core + + +var currentLevel = 0 +var numberOfLevel = 4 +var items +var checkPressed = false +var ycheck +var pressed +var Oneclick +var winlose +var loseflag = false +var minitux="minitux.svg" +var parachutetux="parachute.svg" +var tuxImageStatus = 1 + +function start(items_) { + items = items_ + currentLevel = 0 + initLevel() +} + +function stop() { + items.loop.stop() + items.loopcloud.restart() + items.animationboat.stop() +} + +function initLevel() { + if(loseflag==false){ items.bar.level = currentLevel + 1 } + checkPressed = false + winlose = false + Oneclick = false + pressed = false + ycheck = false + loseflag =false + tuxImageStatus = 0 + items.ok.visible = false + items.loop.restart() + items.tuxX.restart() + items.loopcloud.restart() + items.animationboat.restart() + +} +function onLose(){ + items.loop.stop() + + items.loopcloud.stop() + items.animationboat.stop() + items.tuxX.stop() + items.tuxY.stop() + items.onReleas.stop() + items.onPressUp.stop() + items.onPressdown.stop() + tuxImageStatus = 0 + + items.bonus.bad("lion") + + items.tuximage.visible = false + items.tuximage.source = "qrc:/gcompris/src/activities/parachute/resource/" + minitux + checkPressed =false + winlose = false + Oneclick = false + ycheck = false + pressed = false + loseflag = true + items.tux.x=-items.helimotion.width + items.tux.y=0 + items.loop.restart() + items.tuxX.restart() + items.loopcloud.restart() + items.animationboat.restart() + initLevel() + +} + +function onWin(){ + items.loop.stop() + items.loopcloud.stop() + items.animationboat.stop() + items.tuxX.stop() + items.tuxY.stop() + items.onReleas.stop() + items.onPressUp.stop() + items.onPressdown.stop() + items.tuximage.visible = false + checkPressed =false + winlose = false + Oneclick = false + ycheck = false + pressed = false + items.bonus.good("lion"); + items.tux.x=-items.helimotion.width + items.tux.y=0 + items.ok.visible = true + items.tuximage.source = "qrc:/gcompris/src/activities/parachute/resource/" + minitux +} + +function processPressedKey(event) { + if(tuxImageStatus===2){ + switch(event.key) { + case Qt.Key_Up : event.accepted = true; + if(pressed===false){ + items.tuxY.stop() + items.onPressUp.restart() + pressed=true + }else{ + items.onReleas.stop() + items.onPressUp.restart() + } + console.log("up"); + break; + case Qt.Key_Down : event.accepted = true; + if(pressed===false){ + items.tuxY.stop() + items.onPressdown.restart() + pressed=true + }else{ + items.onReleas.restart() + items.onPressdown.restart() + } + console.log("down"); + break; + } + if(ycheck===false){ + ycheck=true + } + } + +} + +function processReleasedKey(event) { + if(tuxImageStatus===2) + { switch(event.key) { + case Qt.Key_Up : event.accepted = true; + items.onPressUp.stop() + items.onReleas.restart() + break; + case Qt.Key_Down : event.accepted = true; + items.onPressdown.stop() + items.onReleas.restart() + break; + } + + } + +} + +function nextLevel() { + if(numberOfLevel <= ++currentLevel ) { + currentLevel = 0 + } + onreset(); + initLevel(); +} + +function previousLevel() { + if(--currentLevel < 0) { + currentLevel = numberOfLevel - 1 + } + onreset(); + initLevel(); +} + +function onreset(){ + items.loop.stop() + + items.loopcloud.stop() + items.animationboat.stop() + items.tuxX.stop() + items.tuxY.stop() + items.onReleas.stop() + items.onPressUp.stop() + items.onPressdown.stop() + tuxImageStatus = 0 + + items.tuximage.visible = false + items.tuximage.source = "qrc:/gcompris/src/activities/parachute/resource/" + minitux + checkPressed =false + winlose = false + Oneclick = false + ycheck = false + pressed = false + loseflag = true + items.tux.x=-items.helimotion.width + items.tux.y=0 + items.loop.restart() + items.tuxX.restart() + items.loopcloud.restart() + items.animationboat.restart() + initLevel() + +} diff --git a/src/activities/parachute/parachute.svg b/src/activities/parachute/parachute.svg new file mode 100644 index 000000000..cd4f7f112 --- /dev/null +++ b/src/activities/parachute/parachute.svg @@ -0,0 +1,180 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/activities/parachute/resource/back.svg b/src/activities/parachute/resource/back.svg new file mode 100644 index 000000000..b784acb67 --- /dev/null +++ b/src/activities/parachute/resource/back.svg @@ -0,0 +1,3894 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/activities/parachute/resource/bonus.wav b/src/activities/parachute/resource/bonus.wav new file mode 100644 index 000000000..272b7897f Binary files /dev/null and b/src/activities/parachute/resource/bonus.wav differ diff --git a/src/activities/parachute/resource/bubble.wav b/src/activities/parachute/resource/bubble.wav new file mode 100644 index 000000000..398e389b3 Binary files /dev/null and b/src/activities/parachute/resource/bubble.wav differ diff --git a/src/activities/parachute/resource/cloud.svg b/src/activities/parachute/resource/cloud.svg new file mode 100644 index 000000000..f7dbd4d4a --- /dev/null +++ b/src/activities/parachute/resource/cloud.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/activities/parachute/resource/fishingboat.svg b/src/activities/parachute/resource/fishingboat.svg new file mode 100644 index 000000000..2d9d4ba93 --- /dev/null +++ b/src/activities/parachute/resource/fishingboat.svg @@ -0,0 +1,477 @@ + + + +image/svg+xmlGC2004 + \ No newline at end of file diff --git a/src/activities/parachute/resource/minitux.svg b/src/activities/parachute/resource/minitux.svg new file mode 100644 index 000000000..8d965171b --- /dev/null +++ b/src/activities/parachute/resource/minitux.svg @@ -0,0 +1,486 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/src/activities/parachute/resource/parachute.svg b/src/activities/parachute/resource/parachute.svg new file mode 100644 index 000000000..698fc1f2f --- /dev/null +++ b/src/activities/parachute/resource/parachute.svg @@ -0,0 +1,680 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/src/activities/parachute/resource/tuxok.wav b/src/activities/parachute/resource/tuxok.wav new file mode 100644 index 000000000..2d6253b76 Binary files /dev/null and b/src/activities/parachute/resource/tuxok.wav differ diff --git a/src/activities/parachute/resource/tuxplane.svg b/src/activities/parachute/resource/tuxplane.svg new file mode 100644 index 000000000..cd3b77189 --- /dev/null +++ b/src/activities/parachute/resource/tuxplane.svg @@ -0,0 +1,616 @@ + + + +image/svg+xmlGCompris + \ No newline at end of file