diff --git a/src/activities/clickgame/clickgame.svg b/src/activities/clickgame/clickgame.svg
index de367acae..0e6e0fc0d 100644
--- a/src/activities/clickgame/clickgame.svg
+++ b/src/activities/clickgame/clickgame.svg
@@ -1,248 +1,236 @@
diff --git a/src/activities/programmingMaze/ProgrammingMaze.qml b/src/activities/programmingMaze/ProgrammingMaze.qml
index 50027540c..3ae528659 100644
--- a/src/activities/programmingMaze/ProgrammingMaze.qml
+++ b/src/activities/programmingMaze/ProgrammingMaze.qml
@@ -1,410 +1,410 @@
/* GCompris - ProgrammingMaze.qml
*
* Copyright (C) 2015 Siddhesh Suthar
* Copyright (C) 2018 Aman Kumar Gupta
*
* Authors:
* Siddhesh Suthar
* Aman Kumar Gupta
*
* 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.6
import GCompris 1.0
import "../../core"
import "programmingMaze.js" as Activity
ActivityBase {
id: activity
onStart: focus = true
onStop: {}
property int oldWidth: width
onWidthChanged: {
Activity.repositionObjectsOnWidthChanged(width / oldWidth)
oldWidth = width
}
property int oldHeight: height
onHeightChanged: {
Activity.repositionObjectsOnHeightChanged(height / oldHeight)
oldHeight = height
}
property bool keyboardNavigationVisible: false
property string mode: "basic"
property string datasetUrl: "qrc:/gcompris/src/activities/programmingMaze/Dataset.qml"
pageComponent: Image {
id: background
source: "qrc:/gcompris/src/activities/programmingMaze/resource/background.svg"
fillMode: Image.PreserveAspectCrop
sourceSize.width: parent.width
signal start
signal stop
property bool insertIntoMain: true
property alias items: items
property int buttonWidth: background.width / 10
property int buttonHeight: background.height / 15.3
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 GCSfx audioEffects: activity.audioEffects
property alias mazeModel: mazeModel
property alias instructionModel: instructionModel
property alias mainFunctionModel: mainFunctionModel
property alias mainFunctionCodeArea: mainFunctionCodeArea
property alias procedureModel: procedureModel
property alias procedureCodeArea: procedureCodeArea
property alias instructionArea: instructionArea
property alias player: player
property alias constraintInstruction: constraintInstruction
property alias tutorialImage: tutorialImage
property alias fish: fish
property alias dataset: dataset
property bool isRunCodeEnabled: true
property bool isTuxMouseAreaEnabled: false
property bool currentLevelContainsProcedure
property int maxNumberOfInstructionsAllowed
property int numberOfInstructionsAdded
}
// This function catches the signal emitted after completion of movement of Tux after executing each instruction.
function checkSuccessAndExecuteNextInstruction() {
Activity.checkSuccessAndExecuteNextInstruction()
}
// This function catches the signal emitted after finding a dead-end in any of the executing instruction.
function deadEnd() {
Activity.deadEnd()
}
Loader {
id: dataset
}
onStart: { Activity.start(items, mode, datasetUrl) }
onStop: { Activity.stop() }
property var areaWithKeyboardInput: instructionArea
onAreaWithKeyboardInputChanged: activeCodeAreaIndicator.changeActiveCodeAreaIndicator(areaWithKeyboardInput)
Keys.enabled: items.isTuxMouseAreaEnabled || items.isRunCodeEnabled
Keys.onPressed: {
activity.keyboardNavigationVisible = true
if(event.key === Qt.Key_Left)
areaWithKeyboardInput.moveCurrentIndexLeft()
if(event.key === Qt.Key_Right)
areaWithKeyboardInput.moveCurrentIndexRight()
if(event.key === Qt.Key_Up)
areaWithKeyboardInput.moveCurrentIndexUp()
if(event.key === Qt.Key_Down)
areaWithKeyboardInput.moveCurrentIndexDown()
if(event.key === Qt.Key_Space)
areaWithKeyboardInput.spaceKeyPressed()
if(event.key === Qt.Key_Enter || event.key === Qt.Key_Return)
runCodeOrResetTux()
if(event.key === Qt.Key_Tab)
areaWithKeyboardInput.tabKeyPressed()
if(event.key === Qt.Key_Delete && activeCodeAreaIndicator.top != instructionArea.top) {
areaWithKeyboardInput.deleteKeyPressed()
}
}
function runCodeOrResetTux() {
if(!Activity.deadEndPoint)
runCodeMouseArea.executeCode()
else
Activity.initLevel()
}
ListModel {
id: instructionModel
}
ListModel {
id: mainFunctionModel
}
ListModel {
id: procedureModel
}
Rectangle {
id: constraintInstruction
anchors.left: parent.left
anchors.bottom: runCode.top
width: parent.width / 2.3
height: parent.height / 8.9
radius: 10
z: 3
color: "#E8E8E8" //paper white
border.width: 3 * ApplicationInfo.ratio
border.color: "#87A6DD" //light blue
Behavior on opacity { PropertyAnimation { duration: 200 } }
function changeConstraintInstructionOpacity() {
if(opacity)
constraintInstruction.hide()
else
constraintInstruction.show()
}
function show() {
if(instructionText.text)
opacity = 0.8
}
function hide() {
opacity = 0
}
GCText {
id: instructionText
anchors.fill: parent
anchors.margins: parent.border.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
fontSizeMode: Text.Fit
wrapMode: Text.WordWrap
readonly property string resetTuxInstructionText: qsTr("Click on Tux or press Enter key to reset it or RELOAD button to reload the level.")
readonly property string constraintInstructionText: qsTr("Reach the fish in less than %1 instructions.").arg(items.maxNumberOfInstructionsAllowed + 1)
text: items.isTuxMouseAreaEnabled ? resetTuxInstructionText : constraintInstructionText
}
}
MouseArea {
anchors.fill: parent
onClicked: constraintInstruction.changeConstraintInstructionOpacity()
}
Repeater {
id: mazeModel
anchors.left: parent.left
anchors.top: parent.top
Image {
x: modelData.x * width
y: modelData.y * height
width: background.width / 10
height: (background.height - background.height / 10) / 10
- source: Activity.reverseCountUrl + "iceblock.svg"
+ source: Activity.reverseCountUrl + "ice-block.svg"
}
}
Image {
id: fish
sourceSize.width: background.width / 12
source: Activity.reverseCountUrl + "blue-fish.svg"
}
Image {
id: player
source: "qrc:/gcompris/src/activities/maze/resource/tux_top_south.svg"
sourceSize.width: background.width / 12
z: 1
property int duration: 1000
readonly property real playerCenterX: x + width / 2
readonly property real playerCenterY: y + height / 2
MouseArea {
id: tuxMouseArea
anchors.fill: parent
enabled: items.isTuxMouseAreaEnabled
onClicked: {
Activity.initLevel()
}
}
}
Rectangle {
id: activeCodeAreaIndicator
opacity: 0.5
visible: activity.keyboardNavigationVisible
function changeActiveCodeAreaIndicator(activeArea) {
anchors.top = activeArea.top
anchors.fill = activeArea
}
}
InstructionArea {
id: instructionArea
}
HeaderArea {
id: mainFunctionHeader
headerText: qsTr("Main function")
headerOpacity: background.insertIntoMain ? 1 : 0.5
onClicked: background.insertIntoMain = true
anchors.top: parent.top
anchors.right: parent.right
}
CodeArea {
id: mainFunctionCodeArea
currentModel: mainFunctionModel
anchors.right: parent.right
anchors.top: mainFunctionHeader.bottom
onTabKeyPressed: {
mainFunctionCodeArea.currentIndex = -1
if(!items.currentLevelContainsProcedure) {
background.areaWithKeyboardInput = instructionArea
instructionArea.currentIndex = 0
}
else {
background.areaWithKeyboardInput = procedureCodeArea
background.insertIntoMain = false
}
}
}
HeaderArea {
id: procedureHeader
headerText: qsTr("Procedure")
headerOpacity: !background.insertIntoMain ? 1 : 0.5
visible: procedureCodeArea.visible
onClicked: background.insertIntoMain = false
anchors.top: mainFunctionCodeArea.bottom
anchors.right: parent.right
}
CodeArea {
id: procedureCodeArea
currentModel: procedureModel
anchors.right: parent.right
anchors.top: procedureHeader.bottom
visible: items.currentLevelContainsProcedure
property alias procedureIterator: procedureCodeArea.currentIndex
onTabKeyPressed: {
procedureCodeArea.currentIndex = -1
background.areaWithKeyboardInput = instructionArea
instructionArea.currentIndex = 0
background.insertIntoMain = true
}
}
Image {
id: runCode
width: background.width / 10
height: background.height / 10
anchors.right: instructionArea.right
anchors.bottom: bar.top
anchors.margins: 10 * ApplicationInfo.ratio
source:"qrc:/gcompris/src/core/resource/bar_ok.svg"
fillMode: Image.PreserveAspectFit
MouseArea {
id: runCodeMouseArea
anchors.fill: parent
hoverEnabled: ApplicationInfo.isMobile ? false : (!items.isRunCodeEnabled ? false : true)
enabled: items.isRunCodeEnabled
signal executeCode
onEntered: runCode.scale = 1.1
onExecuteCode: {
if(mainFunctionModel.count)
startCodeExecution()
}
onClicked: executeCode()
onExited: runCode.scale = 1
function startCodeExecution() {
runCodeClickAnimation.start()
Activity.resetCodeAreasIndices()
if(constraintInstruction.opacity)
constraintInstruction.hide()
Activity.runCode()
}
}
SequentialAnimation {
id: runCodeClickAnimation
NumberAnimation { target: runCode; property: "scale"; to: 0.8; duration: 100 }
NumberAnimation { target: runCode; property: "scale"; to: 1.0; duration: 100 }
}
}
Image {
id: tutorialImage
source: "qrc:/gcompris/src/activities/guesscount/resource/backgroundW01.svg"
anchors.fill: parent
z: 5
visible: true
property bool shownProcedureTutorialInstructions: false
Tutorial {
id:tutorialSection
tutorialDetails: bar.level <= 2 ? Activity.mainTutorialInstructions : Activity.procedureTutorialInstructions
onSkipPressed: {
Activity.initLevel()
tutorialImage.visible = false
tutorialNumber = 0
}
}
onVisibleChanged: {
if(tutorialImage.visible && tutorialImage.shownProcedureTutorialInstructions)
tutorialSection.visible = true
}
}
DialogHelp {
id: dialogHelp
onClose: home()
}
Bar {
id: bar
content: BarEnumContent { value: tutorialImage.visible ? help | home : help | home | level | reload }
onHelpClicked: {
displayDialog(dialogHelp)
}
onPreviousLevelClicked: Activity.previousLevel()
onNextLevelClicked: Activity.nextLevel()
onHomeClicked: activity.home()
onReloadClicked: Activity.reloadLevel()
}
Bonus {
id: bonus
Component.onCompleted: win.connect(Activity.nextLevel)
}
}
}
diff --git a/src/activities/reversecount/ChooseDiceBar.qml b/src/activities/reversecount/ChooseDiceBar.qml
index f9f4de542..914817fdb 100644
--- a/src/activities/reversecount/ChooseDiceBar.qml
+++ b/src/activities/reversecount/ChooseDiceBar.qml
@@ -1,66 +1,69 @@
/* GCompris - ChooseDiceBar.qml
*
* Copyright (C) 2014 Emmanuel Charruau
*
* Authors:
* Bruno Coudoin (GTK+ version)
* Emmanuel Charruau (Qt Quick port)
* Bruno Coudoin (Major rework)
*
* 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.6
import GCompris 1.0
import "../../core"
import "reversecount.js" as Activity
Item {
id: chooseDiceBar
z: 1000
+ width: barRow.width
+ height: barRow.height
property alias value1: domino.value1
property alias value2: domino.value2
property alias valueMax: domino.valueMax
property alias mode: domino.mode
property GCSfx audioEffects
Row {
id: barRow
spacing: 8
+ anchors.centerIn: parent
BarButton {
id: ok
source: "qrc:/gcompris/src/core/resource/bar_ok.svg";
sourceSize.width: 75 * ApplicationInfo.ratio
visible: true
anchors {
right: undefined
rightMargin: undefined
top: undefined
topMargin: undefined
}
onClicked: Activity.moveTux()
}
Domino {
id: domino
height: ok.height
width: height * 2
isClickable: true
audioEffects: activity.audioEffects
}
}
}
diff --git a/src/activities/reversecount/Reversecount.qml b/src/activities/reversecount/Reversecount.qml
index ae949f9a4..533240ec0 100644
--- a/src/activities/reversecount/Reversecount.qml
+++ b/src/activities/reversecount/Reversecount.qml
@@ -1,289 +1,281 @@
/* GCompris - ReverseCount.qml
*
* Copyright (C) 2014 Emmanuel Charruau
*
* Authors:
* Bruno Coudoin (GTK+ version)
* Emmanuel Charruau (Qt Quick port)
* Bruno Coudoin (Major rework)
+ * Timothée Giet (Layout and graphics rework)
*
* 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.6
import GCompris 1.0
import "../../core"
import "reversecount.js" as Activity
ActivityBase {
id: activity
onStart: focus = true
onStop: {}
pageComponent: Rectangle {
id: background
anchors.fill: parent
- color: "#ff00a4b0"
+ color: "#ff1dade4"
signal start
signal stop
Component.onCompleted: {
dialogActivityConfig.getInitialConfiguration()
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 GCSfx audioEffects: activity.audioEffects
property alias background: background
- property alias backgroundImg: backgroundImg
property alias bar: bar
property alias bonus: bonus
property alias chooseDiceBar: chooseDiceBar
property alias tux: tux
property alias fishToReach: fishToReach
property int clockPosition: 4
property string mode: "dot"
+ property var heightBase: (background.height - bar.height * 1.5) / 5
+ property var widthBase: background.width / 5
+ property bool isHorizontal: background.width >= background.height
}
onStart: { Activity.start(items) }
onStop: { Activity.stop() }
Keys.onEnterPressed: Activity.moveTux()
Keys.onReturnPressed: Activity.moveTux()
onWidthChanged: {
- if(Activity.fishIndex > 0) {
- // set x
- fishToReach.x = Activity.iceBlocksLayout[Activity.fishIndex % Activity.iceBlocksLayout.length][0] *
- background.width / 5 + (background.width / 5 - tux.width) / 2
- // set y
- fishToReach.y = Activity.iceBlocksLayout[Activity.fishIndex % Activity.iceBlocksLayout.length][1] *
- (background.height - background.height/5) / 5 +
- (background.height / 5 - tux.height) / 2
- // Move Tux
- Activity.moveTuxToIceBlock()
- }
+ sizeChangedTimer.restart()
}
onHeightChanged: {
+ sizeChangedTimer.restart()
+ }
+
+ function replaceItems() {
if(Activity.fishIndex > 0) {
// set x
fishToReach.x = Activity.iceBlocksLayout[Activity.fishIndex % Activity.iceBlocksLayout.length][0] *
- background.width / 5 + (background.width / 5 - tux.width) / 2
+ items.widthBase + (items.widthBase - fishToReach.width) / 2
// set y
fishToReach.y = Activity.iceBlocksLayout[Activity.fishIndex % Activity.iceBlocksLayout.length][1] *
- (background.height - background.height/5) / 5 +
- (background.height / 5 - tux.height) / 2
+ items.heightBase + (items.heightBase - fishToReach.height) / 2
// Move Tux
Activity.moveTuxToIceBlock()
}
}
-
- Image {
- id: backgroundImg
- source: Activity.url + Activity.backgrounds[0]
- sourceSize.height: parent.height * 0.5
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
+
+ Timer {
+ id: sizeChangedTimer
+ interval: 100
+ onTriggered: replaceItems()
}
// === The ice blocks ===
Repeater {
model: Activity.iceBlocksLayout
Image {
- x: modelData[0] * background.width / 5
- y: modelData[1] * (background.height- background.height/5) / 5
- width: background.width / 5
- height: background.height / 5
- source: Activity.url + "iceblock.svg"
+ x: modelData[0] * items.widthBase
+ y: modelData[1] * items.heightBase
+ width: items.widthBase
+ height: items.heightBase
+ source: Activity.url + "ice-block.svg"
}
}
Tux {
id: tux
- sourceSize.width: Math.min(background.width / 6, background.height / 6)
+ sourceSize.width: Math.min(items.widthBase, items.heightBase)
z: 11
}
Image {
id: fishToReach
- sourceSize.width: Math.min(background.width / 6, background.height / 6)
+ source: Activity.url + "fish-blue.svg"
+ sourceSize.width: Math.min(items.widthBase, items.heightBase)
z: 10
- property string nextSource
property int nextX
property int nextY
function showParticles() {
particles.burst(40)
}
ParticleSystemStarLoader {
id: particles
clip: false
}
- onOpacityChanged: { if(opacity == 0) { source = ""; source = nextSource; } }
-
- onSourceChanged: {
- if(source != "") {
+ onOpacityChanged: {
+ if(opacity == 0) {
x = nextX
y = nextY
opacity = 1
}
}
Behavior on opacity { NumberAnimation { duration: 500 } }
}
DialogHelp {
id: dialogHelp
onClose: home()
}
Bar {
id: bar
content: BarEnumContent { value: help | home | level | config }
onHelpClicked: {
displayDialog(dialogHelp)
}
onPreviousLevelClicked: Activity.previousLevel()
onNextLevelClicked: Activity.nextLevel()
onHomeClicked: activity.home()
onConfigClicked: {
dialogActivityConfig.active = true
dialogActivityConfig.setDefaultValues()
displayDialog(dialogActivityConfig)
}
}
Image {
id: clock
anchors {
right: parent.right
bottom: parent.bottom
margins: 10
}
sourceSize.width: 66 * bar.barZoom
property int remainingLife: items.clockPosition
onRemainingLifeChanged: if(remainingLife >= 0) clockAnim.restart()
SequentialAnimation {
id: clockAnim
alwaysRunToEnd: true
ParallelAnimation {
NumberAnimation {
target: clock; properties: "opacity";
to: 0; duration: 800; easing.type: Easing.OutCubic
}
NumberAnimation {
target: clock; properties: "rotation"; from: 0; to: 180;
duration: 800; easing.type: Easing.OutCubic
}
}
PropertyAction {
target: clock; property: 'source';
value: "qrc:/gcompris/src/activities/reversecount/resource/" +
"flower" + items.clockPosition + ".svg"
}
ParallelAnimation {
NumberAnimation {
target: clock; properties: "opacity";
to: 1; duration: 800; easing.type: Easing.OutCubic
}
NumberAnimation {
target: clock; properties: "rotation"; from: 180; to: 0;
duration: 800; easing.type: Easing.OutCubic
}
}
}
}
DialogActivityConfig {
id: dialogActivityConfig
currentActivity: activity
content: Component {
Item {
property alias modeBox: modeBox
property var availableModes: [
{ "text": qsTr("Dots"), "value": "dot" },
{ "text": qsTr("Arabic numbers"), "value": "number" },
{ "text": qsTr("Roman numbers"), "value": "roman" },
{ "text": qsTr("Images"), "value": "image" }
]
Flow {
id: flow
spacing: 5
width: dialogActivityConfig.width
GCComboBox {
id: modeBox
model: availableModes
background: dialogActivityConfig
label: qsTr("Select Domino Representation")
}
}
}
}
onClose: home()
onLoadData: {
if(dataToSave && dataToSave["mode"]) {
items.mode = dataToSave["mode"];
}
}
onSaveData: {
var newMode = dialogActivityConfig.configItem.availableModes[dialogActivityConfig.configItem.modeBox.currentIndex].value;
if (newMode !== items.mode) {
items.mode = newMode;
dataToSave = {"mode": items.mode};
}
Activity.initLevel();
}
function setDefaultValues() {
for(var i = 0 ; i < dialogActivityConfig.configItem.availableModes.length ; i++) {
if(dialogActivityConfig.configItem.availableModes[i].value === items.mode) {
dialogActivityConfig.configItem.modeBox.currentIndex = i;
break;
}
}
}
}
ChooseDiceBar {
id: chooseDiceBar
mode: items.mode
- x: background.width / 5 + 20
- y: (background.height - background.height/5) * 3 / 5
+ anchors.horizontalCenter: items.background.horizontalCenter
+ y: items.heightBase * 2
audioEffects: activity.audioEffects
}
Bonus {
id: bonus
winSound: "qrc:/gcompris/src/activities/ballcatch/resource/tuxok.wav"
looseSound: "qrc:/gcompris/src/activities/ballcatch/resource/youcannot.wav"
onWin: Activity.nextLevel()
onLoose: Activity.initLevel()
}
}
}
diff --git a/src/activities/reversecount/Tux.qml b/src/activities/reversecount/Tux.qml
index d2df4de9e..166151c60 100644
--- a/src/activities/reversecount/Tux.qml
+++ b/src/activities/reversecount/Tux.qml
@@ -1,64 +1,64 @@
/* GCompris - Tux.qml
*
* Copyright (C) 2014 Emmanuel Charruau
*
* Authors:
* Bruno Coudoin (GTK+ version)
* Emmanuel Charruau (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.6
import "reversecount.js" as Activity
import GCompris 1.0
Image {
id: tux
- source: Activity.url + "tux_top_south.svg"
+ source: "qrc:/gcompris/src/activities/maze/resource/tux_top_south.svg"
fillMode: Image.PreserveAspectFit
z: 10
property int duration: 1000
signal init
onInit: {
tux.rotation = -90
Activity.moveTuxToIceBlock()
}
Behavior on x {
SmoothedAnimation {
reversingMode: SmoothedAnimation.Immediate
onRunningChanged: Activity.tuxRunningChanged()
duration: tux.duration
}
}
Behavior on y {
SmoothedAnimation {
reversingMode: SmoothedAnimation.Immediate
onRunningChanged: Activity.tuxRunningChanged()
duration: tux.duration
}
}
Behavior on rotation {
RotationAnimation {
duration: tux.duration / 2
direction: RotationAnimation.Shortest
}
}
}
diff --git a/src/activities/reversecount/resource/Benzfish.svg b/src/activities/reversecount/resource/Benzfish.svg
deleted file mode 100644
index b961b20ac..000000000
--- a/src/activities/reversecount/resource/Benzfish.svg
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/Fish02.svg b/src/activities/reversecount/resource/Fish02.svg
deleted file mode 100644
index 2d1c149a7..000000000
--- a/src/activities/reversecount/resource/Fish02.svg
+++ /dev/null
@@ -1,283 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/README b/src/activities/reversecount/resource/README
index d68a7f9dc..b8601e973 100644
--- a/src/activities/reversecount/resource/README
+++ b/src/activities/reversecount/resource/README
@@ -1,36 +1,9 @@
icy_walk.wav: https://www.freesound.org/people/Corsica_S/sounds/28662/
This work is licensed under the Attribution License.
-Copyright: Timothée Giet, 2016
+Copyright: Timothée Giet, 2016 - 2019
License: CC-BY-SA 4.0
Files:
+fish-blue.svg
flower*.svg
-
-Copyright: Various - openclipart
-License: Public domain
-Files:
-baleine.svg
-Benzfish.svg
-blue-fish.svg
-drunken_duck_cartoon_globefish_kugelfisch.svg
-elephant_mer.svg
-epaulard.svg
-Fish02.svg
-flower0.svg
-flower1.svg
-flower2.svg
-flower3.svg
-flower4.svg
-flower5.svg
-flower6.svg
-iceblock.svg
-icy_walk.wav
-molumen_Codfish.svg
-morse.svg
-mystica_Aquarium_fish_-_Amphiprion_percula.svg
-narval.svg
-ourspolaire.svg
-pepinux_Pez_dorado.svg
-phoque.svg
-The_Whale-Fish.svg
-tux_top_south.svg
+ice-block.svg
diff --git a/src/activities/reversecount/resource/The_Whale-Fish.svg b/src/activities/reversecount/resource/The_Whale-Fish.svg
deleted file mode 100644
index aa915e97c..000000000
--- a/src/activities/reversecount/resource/The_Whale-Fish.svg
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
diff --git a/src/activities/reversecount/resource/baleine.svg b/src/activities/reversecount/resource/baleine.svg
deleted file mode 100644
index 76dfe5909..000000000
--- a/src/activities/reversecount/resource/baleine.svg
+++ /dev/null
@@ -1,344 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/blue-fish.svg b/src/activities/reversecount/resource/blue-fish.svg
deleted file mode 100644
index 4e4087b81..000000000
--- a/src/activities/reversecount/resource/blue-fish.svg
+++ /dev/null
@@ -1,6250 +0,0 @@
-
-
diff --git a/src/activities/reversecount/resource/drunken_duck_cartoon_globefish_kugelfisch.svg b/src/activities/reversecount/resource/drunken_duck_cartoon_globefish_kugelfisch.svg
deleted file mode 100644
index e964f330c..000000000
--- a/src/activities/reversecount/resource/drunken_duck_cartoon_globefish_kugelfisch.svg
+++ /dev/null
@@ -1,771 +0,0 @@
-
-
diff --git a/src/activities/reversecount/resource/elephant_mer.svg b/src/activities/reversecount/resource/elephant_mer.svg
deleted file mode 100644
index d2410f1b5..000000000
--- a/src/activities/reversecount/resource/elephant_mer.svg
+++ /dev/null
@@ -1,535 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/epaulard.svg b/src/activities/reversecount/resource/epaulard.svg
deleted file mode 100644
index da7533f57..000000000
--- a/src/activities/reversecount/resource/epaulard.svg
+++ /dev/null
@@ -1,514 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/fish-blue.svg b/src/activities/reversecount/resource/fish-blue.svg
new file mode 100644
index 000000000..910cc248b
--- /dev/null
+++ b/src/activities/reversecount/resource/fish-blue.svg
@@ -0,0 +1,186 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/ice-block.svg b/src/activities/reversecount/resource/ice-block.svg
new file mode 100644
index 000000000..133c6522f
--- /dev/null
+++ b/src/activities/reversecount/resource/ice-block.svg
@@ -0,0 +1,89 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/iceblock.svg b/src/activities/reversecount/resource/iceblock.svg
deleted file mode 100644
index 1212486a8..000000000
--- a/src/activities/reversecount/resource/iceblock.svg
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/molumen_Codfish.svg b/src/activities/reversecount/resource/molumen_Codfish.svg
deleted file mode 100644
index 3136c3ea1..000000000
--- a/src/activities/reversecount/resource/molumen_Codfish.svg
+++ /dev/null
@@ -1,619 +0,0 @@
-
-
diff --git a/src/activities/reversecount/resource/morse.svg b/src/activities/reversecount/resource/morse.svg
deleted file mode 100644
index a1e08250d..000000000
--- a/src/activities/reversecount/resource/morse.svg
+++ /dev/null
@@ -1,717 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/mystica_Aquarium_fish_-_Amphiprion_percula.svg b/src/activities/reversecount/resource/mystica_Aquarium_fish_-_Amphiprion_percula.svg
deleted file mode 100644
index 7adb96a1e..000000000
--- a/src/activities/reversecount/resource/mystica_Aquarium_fish_-_Amphiprion_percula.svg
+++ /dev/null
@@ -1,452 +0,0 @@
-
-
diff --git a/src/activities/reversecount/resource/narval.svg b/src/activities/reversecount/resource/narval.svg
deleted file mode 100644
index b5ce3505f..000000000
--- a/src/activities/reversecount/resource/narval.svg
+++ /dev/null
@@ -1,317 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/ourspolaire.svg b/src/activities/reversecount/resource/ourspolaire.svg
deleted file mode 100644
index 072936e87..000000000
--- a/src/activities/reversecount/resource/ourspolaire.svg
+++ /dev/null
@@ -1,738 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/pepinux_Pez_dorado.svg b/src/activities/reversecount/resource/pepinux_Pez_dorado.svg
deleted file mode 100644
index 55ecab5c0..000000000
--- a/src/activities/reversecount/resource/pepinux_Pez_dorado.svg
+++ /dev/null
@@ -1,277 +0,0 @@
-
-
diff --git a/src/activities/reversecount/resource/phoque.svg b/src/activities/reversecount/resource/phoque.svg
deleted file mode 100644
index 970f91558..000000000
--- a/src/activities/reversecount/resource/phoque.svg
+++ /dev/null
@@ -1,335 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/resource/tux_top_south.svg b/src/activities/reversecount/resource/tux_top_south.svg
deleted file mode 100644
index da60e22f2..000000000
--- a/src/activities/reversecount/resource/tux_top_south.svg
+++ /dev/null
@@ -1,164 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/activities/reversecount/reversecount.js b/src/activities/reversecount/reversecount.js
index 2a315a64c..8267d57e2 100644
--- a/src/activities/reversecount/reversecount.js
+++ b/src/activities/reversecount/reversecount.js
@@ -1,308 +1,276 @@
/* GCompris - reversecount.js
*
* Copyright (C) 2014 Emmanuel Charruau
*
* Authors:
* Bruno Coudoin (GTK+ version)
* Emmanuel Charruau (Qt Quick port)
* Bruno Coudoin (Major rework)
*
* 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.6 as Quick
.import GCompris 1.0 as GCompris //for ApplicationInfo
var iceBlocksLayout = [[0, 0],[1, 0],[2, 0],[3, 0],[4, 0],
[4, 1],[4, 2],[4, 3],[4, 4],[3, 4],
[2, 4],[1, 4],[0, 4],[0, 3],[0, 2],
[0, 1]]
-var backgrounds = [
- "baleine.svg",
- "phoque.svg",
- "ourspolaire.svg",
- "morse.svg",
- "elephant_mer.svg",
- "epaulard.svg",
- "narval.svg"
- ]
-
var tuxIceBlockNumber = 0
var tuxIceBlockNumberGoal = 0
var tuxIsMoving = false;
var debuginttmp = 0
var placeFishToReachBool = false
var level = null;
-var fishes = [
- "Benzfish.svg",
- "blue-fish.svg",
- "drunken_duck_cartoon_globefish_kugelfisch.svg",
- "Fish02.svg",
- "molumen_Codfish.svg",
- "mystica_Aquarium_fish_-_Amphiprion_percula.svg",
- "pepinux_Pez_dorado.svg",
- "The_Whale-Fish.svg",
- "Benzfish.svg",
- "blue-fish.svg",
- "drunken_duck_cartoon_globefish_kugelfisch.svg",
- "Fish02.svg"
- ]
-
-
var levels = [
{
"maxNumber": 1, /* Max number on each domino side */
"minNumber": 1,
"numberOfFish": 3
},
{
"maxNumber": 2,
"minNumber": 1,
"numberOfFish": 4
},
{
"maxNumber": 3,
"minNumber": 1,
"numberOfFish": 5
},
{
"maxNumber": 4,
"minNumber": 1,
"numberOfFish": 5
},
{
"maxNumber": 5,
"minNumber": 2,
"numberOfFish": 5
},
{
"maxNumber": 6,
"minNumber": 3,
"numberOfFish": 5
},
{
"maxNumber": 7,
"minNumber": 4,
"numberOfFish": 5
},
{
"maxNumber": 8,
"minNumber": 4,
"numberOfFish": 5
},
{
"maxNumber": 9,
"minNumber": 5,
"numberOfFish": 5
},
]
var numberOfFish
var fishIndex = -1
var currentLevel = 0
var numberOfLevel = levels.length
var items
var url = "qrc:/gcompris/src/activities/reversecount/resource/"
function start(items_) {
items = items_
currentLevel = 0
initLevel()
}
function stop() {
fishIndex = -1
}
function initLevel() {
items.bar.level = currentLevel + 1
items.chooseDiceBar.value1 = 0
items.chooseDiceBar.value2 = 0
items.chooseDiceBar.valueMax = levels[currentLevel].maxNumber
numberOfFish = levels[currentLevel].numberOfFish
fishIndex = 0
tuxIceBlockNumber = 0
items.tux.init()
calculateNextPlaceFishToReach()
placeFishToReach()
moveTuxToIceBlock()
- items.backgroundImg.source = url + backgrounds[currentLevel % backgrounds.length]
items.clockPosition = 4
}
function moveTux() {
calculateTuxIceBlockNextPos()
if (tuxIceBlockNumberGoal > fishIndex)
{
items.clockPosition--
if (items.clockPosition === 0) {
lost()
return
}
}
else if (items.chooseDiceBar.value1 != 0 || items.chooseDiceBar.value2 != 0 ) {
moveTuxToNextIceBlock()
}
}
function moveTuxToNextIceBlock() {
tuxIsMoving = false;
tuxIceBlockNumber++
tuxIceBlockNumber = tuxIceBlockNumber % iceBlocksLayout.length
if (tuxIceBlockNumber >= 0 && tuxIceBlockNumber <= 4)
items.tux.rotation = -90
else if (tuxIceBlockNumber >= 5 && tuxIceBlockNumber <= 8)
items.tux.rotation = 0
else if (tuxIceBlockNumber >= 9 && tuxIceBlockNumber <= 12)
items.tux.rotation = 90
else if (tuxIceBlockNumber >= 13 && tuxIceBlockNumber <= 15)
items.tux.rotation = 180
moveTuxToIceBlock()
var fishPos = fishIndex % iceBlocksLayout.length
//if tux reaches its position + dice number
if (tuxIceBlockNumber == fishPos) {
tuxIsMoving = false;
// if last fish reached
if (--numberOfFish == 0) {
won()
items.fishToReach.showParticles()
items.clockPosition++
return
}
items.audioEffects.play('qrc:/gcompris/src/activities/gnumch-equality/resource/eat.wav')
calculateNextPlaceFishToReach()
placeFishToReachBool = true
return
}
items.audioEffects.play(url + 'icy_walk.wav')
//if tux reaches its position + dice number before reaching the fish, calculation was wrong
if (tuxIceBlockNumber == tuxIceBlockNumberGoal) {
items.clockPosition--
if (items.clockPosition === 0) {
lost()
return
}
tuxIsMoving = false;
return
}
tuxIsMoving = true
}
function moveTuxToIceBlock() {
items.tux.x = iceBlocksLayout[tuxIceBlockNumber % iceBlocksLayout.length][0] *
- items.background.width / 5 +
- (items.background.width / 5 - items.tux.width) / 2
+ items.widthBase + (items.widthBase - items.tux.width) / 2
items.tux.y = iceBlocksLayout[tuxIceBlockNumber % iceBlocksLayout.length][1] *
- (items.background.height - items.background.height/5) / 5 +
- (items.background.height / 5 - items.tux.height) / 2
+ items.heightBase + (items.heightBase - items.tux.height) / 2
}
function tuxRunningChanged() {
if (tuxIsMoving) {
moveTuxToNextIceBlock()
} else {
if (placeFishToReachBool == true) {
placeFishToReach(fishIndex)
placeFishToReachBool = false
}
}
}
function calculateTuxIceBlockNextPos() {
tuxIceBlockNumberGoal = tuxIceBlockNumber +
items.chooseDiceBar.value1 + items.chooseDiceBar.value2
// Increase Tux's speed depending on the number of blocks to move
items.tux.duration = 1000 -
(items.chooseDiceBar.value1 + items.chooseDiceBar.value2) * 40
}
var previousFishIndex = 0
function calculateNextPlaceFishToReach() {
var newFishIndex
do {
newFishIndex = Math.floor(Math.random() *
(levels[currentLevel].maxNumber * 2 -
levels[currentLevel].minNumber + 1)) +
levels[currentLevel].minNumber
} while((previousFishIndex === newFishIndex) || (newFishIndex >= iceBlocksLayout.length))
previousFishIndex = newFishIndex
fishIndex = tuxIceBlockNumber + newFishIndex
}
function placeFishToReach() {
// placeFishToReach can be called when the opacity is 0.
// In this case, this does not trigger the onOpacityChanged of the fish Image (meaning the fish will not be displayed) so we directly set the opacity to 1.
if(items.fishToReach.opacity == 0)
items.fishToReach.opacity = 1
else
items.fishToReach.opacity = 0
- items.fishToReach.nextSource = url + fishes[fishIndex % fishes.length]
items.fishToReach.nextX = iceBlocksLayout[fishIndex % iceBlocksLayout.length][0] *
- items.background.width / 5 +
- (items.background.width / 5 - items.tux.width) / 2
+ items.widthBase + (items.widthBase - items.fishToReach.width) / 2
items.fishToReach.nextY = iceBlocksLayout[fishIndex % iceBlocksLayout.length][1] *
- (items.background.height - items.background.height/5) / 5 +
- (items.background.height / 5 - items.tux.height) / 2
+ items.heightBase + (items.heightBase - items.fishToReach.height) / 2
}
function nextLevel() {
if(numberOfLevel <= ++currentLevel) {
currentLevel = 0
}
initLevel();
}
function previousLevel() {
if(--currentLevel < 0) {
currentLevel = numberOfLevel - 1
}
initLevel();
}
function lost() {
items.bonus.bad("tux")
}
function won() {
items.bonus.good("flower")
}
diff --git a/src/activities/reversecount/reversecount.svg b/src/activities/reversecount/reversecount.svg
index 62e1e807a..f88d8bddb 100644
--- a/src/activities/reversecount/reversecount.svg
+++ b/src/activities/reversecount/reversecount.svg
@@ -1,465 +1,452 @@