diff --git a/src/activities/submarine/Submarine.qml b/src/activities/submarine/Submarine.qml index 0772bcdbe..c2af8dc3d 100644 --- a/src/activities/submarine/Submarine.qml +++ b/src/activities/submarine/Submarine.qml @@ -1,95 +1,298 @@ /* GCompris - submarine.qml * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * Bruno Coudoin (bruno.coudoin@gcompris.net) (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 QtQuick 2.3 import Box2D 2.0 +import QtGraphicalEffects 1.0 import "../../core" import "submarine.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: {} property string url: "qrc:/gcompris/src/activities/submarine/resource/" pageComponent: Image { id: background anchors.fill: parent - source: url + "backgroundcover.svg" + source: url + "background.svg" signal start signal stop Component.onCompleted: { activity.start.connect(start) activity.stop.connect(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 bar: bar property alias bonus: bonus + property var submarineCategory: Fixture.Category1 + property var crownCategory: Fixture.Category2 + property var whaleCategory: Fixture.Category3 + property var upperGatefixerCategory: Fixture.Category4 + property var lowerGatefixerCategory: Fixture.Category5 + + } + + IntroMessage { + id: message + anchors { + top: parent.top + topMargin: 10 + right: parent.right + rightMargin: 5 + left: parent.left + leftMargin: 5 + } + z: 100 + onIntroDone: { + + } + intro: [ + qsTr(""), + qsTr(""), + qsTr(""), + ] } onStart: { Activity.start(items) } onStop: { Activity.stop() } + World { + id: pysicalworld + running: false + gravity: Qt.point(0,0) + autoClearForces: false + } + + Item { + id: submarine + + Image { + id: submarineImage + source: url + "submarine.png" + width: background.width/9 + height: background.height/9 + + function showimage() { + visible = true + } + + function hideimage() { + visible = false + } + } + + Image { + id: brokensubmarineImage + source: url + "submarine-broken.png" + visible: false + + function show() { + visible = true + } + + function hide() { + visible = false + } + } + + Body { + id: submarinebody + target: submarine + bodyType: Body.Dynamic + fixedRotation: true + linearDamping: 0 + fixtures : Box { + id: sumbmarinefixer + categories: items.submarineCategory + collidesWith: items.crowCategory | items.whaleCategory + density: 1 + friction: 0 + restitution: 0 + + } + } + + } + + Rectangle { + id: upperGate + width: background.width/18 + height: background.height - background.height/4 - background.height/3 + y: -2 + color: "#848484" + border.color: "black" + border.width: 3 + anchors.right:background.right + + Body{ + id: upperGatebody + target: upperGate + bodyType: Body.Static + sleepingAllowed: true + fixedRotation: true + linearDamping: 0 + + fixtures: Box { + id: upperGatefixer + categories: items.upperGatefixerCategory + collidesWith: items.submarineCategory + density: 1 + friction: 0 + restitution: 0 + } + + } + + } + + Rectangle { + id: lowergate + width: background.width/18 + height: upperGate.height- subSchematImage.height/1.4 + y: upperGate.height+3 + color: "#848484" + border.color: "black" + border.width: 3 + anchors.right:background.right + Body{ + id: lowerGatebody + target: upperGate + bodyType: Body.Static + sleepingAllowed: true + fixedRotation: true + linearDamping: 0 + + fixtures: Box { + id: lowerGatefixer + categories: items.lowerGatefixerCategory + collidesWith: items.submarineCategory + density: 1 + friction: 0 + restitution: 0 + } + + } + + } + + Item { + id: subSchemaItems + + Image { + id:subSchematImage + source: url + "sub_schema.svg" + width: background.width/1.3 + height: background.height/4 + x: background.width/9 + y: background.height/1.5 + } + } + DialogHelp { id: dialogHelp onClose: home() } - Image{ - id: submarine - source: url + "submarine.svg" - width:background.width/9 - height:background.height/9 + Image { + id: crown + source: url + "crown.png" + z: 1 + //width: background.width/12 + //height: background.height/12 + Body { + id: crownbody + target: crown + bodyType: Body.Static + sleepingAllowed: true + fixedRotation: true + linearDamping: 0 + + fixtures: Box { + id: crownfixer + categories: items.crownCategory + collidesWith: items.submarineCategory + density: 1 + friction: 0 + restitution: 0 + } + } } - Image{ - id: crown - source: url + "crown.svg" - width:background.width/12 - height:background.height/12 + Image { + id: whale + source: url + "whale.png" + z: 1 + //width: background.width/12 + //height: background.height/12 + function imagechange() { + whale.source = url + "whale_hit.png" + } + + Body { + id: whalebody + target: whale + bodyType: Body.Static + sleepingAllowed: true + fixedRotation: true + linearDamping: 0 + + fixtures: Box { + id: whalefixer + categories: items.whaleCategory + collidesWith: items.submarineCategory + density: 1 + friction: 0 + restitution: 0 + } + } } + + Bar { id: bar content: BarEnumContent { value: help | home | level } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() } Bonus { id: bonus Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/submarine/resource/alert_submarine.png b/src/activities/submarine/resource/alert_submarine.png new file mode 100644 index 000000000..5dfb902ca Binary files /dev/null and b/src/activities/submarine/resource/alert_submarine.png differ diff --git a/src/activities/submarine/resource/asw_frigate.png b/src/activities/submarine/resource/asw_frigate.png new file mode 100644 index 000000000..cff706efc Binary files /dev/null and b/src/activities/submarine/resource/asw_frigate.png differ diff --git a/src/activities/submarine/resource/background.svg b/src/activities/submarine/resource/background.svg index d5e0d41c6..99ff74976 100644 --- a/src/activities/submarine/resource/background.svg +++ b/src/activities/submarine/resource/background.svg @@ -1,158 +1,383 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="metadata4531"> image/svg+xml - + - - - - - - - - - - - - - - - - - + inkscape:label="Calque 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-513.56087,-460.93362)"> + + style="color:#000000;fill:#dedacf;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new" + d="m 583.20629,801.79071 670.51431,-1.42857 c 69.7149,-0.14853 59.8509,18.12671 59.8509,69.13659 l 0,44.58397 c 0,65.36738 5.5165,67.70801 -67.708,67.70801 l -662.65721,0 c -81.79596,0 -67.70801,-14.48348 -67.70801,-67.70801 l 0,-44.58397 c 0,-58.22453 -9.09382,-67.54439 67.70801,-67.70802 z" + id="rect6560" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sssssssss" /> + sodipodi:type="arc" + style="color:#000000;fill:#cf2422;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter7523);enable-background:new" + id="path7521" + sodipodi:cx="623.57141" + sodipodi:cy="796.64789" + sodipodi:rx="7.1428571" + sodipodi:ry="7.1428571" + d="m 630.71427,796.64789 a 7.1428571,7.1428571 0 0 1 -7.14286,7.14286 7.1428571,7.1428571 0 0 1 -7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,7.14286 z" + transform="translate(-79.361114,29.361165)" /> + sodipodi:type="arc" + style="color:#000000;fill:#22cf49;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter7523-2);enable-background:new" + id="path7521-0" + sodipodi:cx="623.57141" + sodipodi:cy="796.64789" + sodipodi:rx="7.1428571" + sodipodi:ry="7.1428571" + d="m 630.71427,796.64789 a 7.1428571,7.1428571 0 0 1 -7.14286,7.14286 7.1428571,7.1428571 0 0 1 -7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,7.14286 z" + transform="translate(-58.646804,29.361175)" /> + + + + + Pi + + + + + + Co + + sodipodi:type="arc" + style="color:#000000;fill:#cf2422;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter7523-7);enable-background:new" + id="path7521-3" + sodipodi:cx="623.57141" + sodipodi:cy="796.64789" + sodipodi:rx="7.1428571" + sodipodi:ry="7.1428571" + d="m 630.71427,796.64789 a 7.1428571,7.1428571 0 0 1 -7.14286,7.14286 7.1428571,7.1428571 0 0 1 -7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,7.14286 z" + transform="translate(631.21662,165.85573)" /> + sodipodi:type="arc" + style="color:#000000;fill:#22cf49;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter7523-2-0);enable-background:new" + id="path7521-0-6" + sodipodi:cx="623.57141" + sodipodi:cy="796.64789" + sodipodi:rx="7.1428571" + sodipodi:ry="7.1428571" + d="m 630.71427,796.64789 a 7.1428571,7.1428571 0 0 1 -7.14286,7.14286 7.1428571,7.1428571 0 0 1 -7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,-7.14286 7.1428571,7.1428571 0 0 1 7.14286,7.14286 z" + transform="translate(651.93093,165.85574)" /> + + + + + Xi + + + + + + Tr + diff --git a/src/activities/submarine/resource/backgroundcover.svg b/src/activities/submarine/resource/backgroundcover.svg deleted file mode 100644 index 25ddd1327..000000000 --- a/src/activities/submarine/resource/backgroundcover.svg +++ /dev/null @@ -1,1921 +0,0 @@ - - - - Sea Fantasy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Openclipart - - - Sea Fantasy - 2012-05-23T14:26:01 - Painting from the narratives of a small child. - https://openclipart.org/detail/170172/sea-fantasy-by-frankes-170172 - - - frankes - - - - - Delfin - Fantasie - Fee - Geschichte - Meer - Ozean - Tiere - Wal - animal - delphin - fairy - fantasy - ocean - sea - story - whale - - - - - - - - - - - diff --git a/src/activities/submarine/resource/bubbling.png b/src/activities/submarine/resource/bubbling.png new file mode 100644 index 000000000..1a6a45206 Binary files /dev/null and b/src/activities/submarine/resource/bubbling.png differ diff --git a/src/activities/submarine/resource/crown.png b/src/activities/submarine/resource/crown.png new file mode 100644 index 000000000..0e8e81e24 Binary files /dev/null and b/src/activities/submarine/resource/crown.png differ diff --git a/src/activities/submarine/resource/crown.svg b/src/activities/submarine/resource/crown.svg deleted file mode 100644 index 4e22811dc..000000000 --- a/src/activities/submarine/resource/crown.svg +++ /dev/null @@ -1,588 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Openclipart - - - Crown - 2009-04-03T08:29:11 - King's crown (originally named "couronne") by Franck Doucet. From old OCAL website. - https://openclipart.org/detail/23859/crown-by-anonymous-23859 - - - Anonymous - - - - - clothing - crown - gold - golden - jewel - jewellery - metallic - party - royal - - - - - - - - - - - diff --git a/src/activities/submarine/resource/down.png b/src/activities/submarine/resource/down.png new file mode 100644 index 000000000..5a86c05ea Binary files /dev/null and b/src/activities/submarine/resource/down.png differ diff --git a/src/activities/submarine/resource/rudder.png b/src/activities/submarine/resource/rudder.png new file mode 100644 index 000000000..38b531fed Binary files /dev/null and b/src/activities/submarine/resource/rudder.png differ diff --git a/src/activities/submarine/resource/sub_schema.svg b/src/activities/submarine/resource/sub_schema.svg new file mode 100644 index 000000000..c8e5fd094 --- /dev/null +++ b/src/activities/submarine/resource/sub_schema.svg @@ -0,0 +1,2224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/activities/submarine/resource/submarine-broken.png b/src/activities/submarine/resource/submarine-broken.png new file mode 100644 index 000000000..40e28fcf4 Binary files /dev/null and b/src/activities/submarine/resource/submarine-broken.png differ diff --git a/src/activities/submarine/resource/submarine.png b/src/activities/submarine/resource/submarine.png new file mode 100644 index 000000000..78c194ccb Binary files /dev/null and b/src/activities/submarine/resource/submarine.png differ diff --git a/src/activities/submarine/resource/submarine.svg b/src/activities/submarine/resource/submarine.svg deleted file mode 100644 index ffad08e4d..000000000 --- a/src/activities/submarine/resource/submarine.svg +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/activities/submarine/resource/up.png b/src/activities/submarine/resource/up.png new file mode 100644 index 000000000..76b74047d Binary files /dev/null and b/src/activities/submarine/resource/up.png differ diff --git a/src/activities/submarine/resource/vanne.svg b/src/activities/submarine/resource/vanne.svg new file mode 100644 index 000000000..3ae0efc0b --- /dev/null +++ b/src/activities/submarine/resource/vanne.svg @@ -0,0 +1,72 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/activities/submarine/resource/whale.png b/src/activities/submarine/resource/whale.png new file mode 100644 index 000000000..5a95596a7 Binary files /dev/null and b/src/activities/submarine/resource/whale.png differ diff --git a/src/activities/submarine/resource/whale_hit.png b/src/activities/submarine/resource/whale_hit.png new file mode 100644 index 000000000..2ee76bd28 Binary files /dev/null and b/src/activities/submarine/resource/whale_hit.png differ diff --git a/src/activities/submarine/submarine.js b/src/activities/submarine/submarine.js index 0a70dddbb..b8f943a28 100644 --- a/src/activities/submarine/submarine.js +++ b/src/activities/submarine/submarine.js @@ -1,54 +1,59 @@ /* GCompris - submarine.js * * Copyright (C) 2016 RAJDEEP KAUR * * Authors: * Bruno Coudoin (bruno.coudoin@gcompris.net) (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 GCompris 1.0 as GCompris .import QtQuick 2.0 as Quick var currentLevel = 0 var numberOfLevel = 4 var items +var barAtStart function start(items_) { items = items_ currentLevel = 0 + barAtStart = GCompris.ApplicationSettings.isBarHidden; + GCompris.ApplicationSettings.isBarHidden = true; initLevel() } function stop() { + GCompris.ApplicationSettings.isBarHidden = barAtStart; } function initLevel() { items.bar.level = currentLevel + 1 } function nextLevel() { if(numberOfLevel <= ++currentLevel ) { currentLevel = 0 } initLevel(); } function previousLevel() { if(--currentLevel < 0) { currentLevel = numberOfLevel - 1 } initLevel(); }