diff --git a/src/activities/activities.txt b/src/activities/activities.txt index be6b07605..afb7b334a 100644 --- a/src/activities/activities.txt +++ b/src/activities/activities.txt @@ -1,125 +1,126 @@ # 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 land_safe 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 +nine_men_morris numbers-odd-even paintings penalty photo_hunter planegame readingh readingv redraw redraw_symmetrical renewable_energy reversecount scalesboard scalesboard_weight scalesboard_weight_avoirdupois simplepaint smallnumbers smallnumbers2 sudoku superbrain tangram target tic_tac_toe tic_tac_toe_2players traffic watercycle wordsgame diff --git a/src/activities/nine_men_morris/ActivityInfo.qml b/src/activities/nine_men_morris/ActivityInfo.qml new file mode 100644 index 000000000..cbfc97059 --- /dev/null +++ b/src/activities/nine_men_morris/ActivityInfo.qml @@ -0,0 +1,35 @@ +/* GCompris - ActivityInfo.qml + * + * Copyright (C) 2016 Pulkit 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 GCompris 1.0 + +ActivityInfo { + name: "nine_men_morris/NineMenMorris.qml" + difficulty: 2 + icon: "nine_men_morris/nine_men_morris.svg" + author: "Pulkit Gupta <pulkitnsit@gmail.com>" + demo: true + title: "Nine men's morris (against Tux)" + description: "Reduce the opponent to two pieces, or by leaving him without a legal move." + //intro: "put here in comment the text for the intro voice" + goal: "" + prerequisite: "" + manual: "Play with the computer. First take turns to place nine pieces, and then take turns to move pieces" + credit: "" + section: "strategy" + createdInVersion: 6000 +} diff --git a/src/activities/nine_men_morris/CMakeLists.txt b/src/activities/nine_men_morris/CMakeLists.txt new file mode 100644 index 000000000..dc08e7217 --- /dev/null +++ b/src/activities/nine_men_morris/CMakeLists.txt @@ -0,0 +1 @@ +GCOMPRIS_ADD_RCC(activities/nine_men_morris *.qml *.svg *.js resource/*) diff --git a/src/activities/nine_men_morris/NineMenMorris.qml b/src/activities/nine_men_morris/NineMenMorris.qml new file mode 100644 index 000000000..8509bc1d6 --- /dev/null +++ b/src/activities/nine_men_morris/NineMenMorris.qml @@ -0,0 +1,644 @@ +/* GCompris - NineMenMorris.qml + * + * Copyright (C) 2016 Pulkit Gupta + * + * Authors: + * Pulkit 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.1 + +import "../../core" +import "nine_men_morris.js" as Activity + +ActivityBase { + id: activity + + property bool twoPlayer: false + onStart: focus = true + onStop: {} + + pageComponent: Image { + id: background + anchors.fill: parent + source: Activity.url + "background.svg" + sourceSize.width: Math.max(parent.width, parent.height) + fillMode: Image.PreserveAspectCrop + 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 board: board + + property alias tutorialImage: tutorialImage.source + property alias tutorialTxt: tutorialTxt.text + property alias tutNum: tutorialTxt.tutNum + property bool isTutorial + + property alias player1: player1 + property alias firstInitial: firstInitial + property alias player1background: player1background.visible + property alias player1_score: player1_score.text + property alias player1turn: player1turn + property alias player1shrink: player1shrink + property alias player1image: player1image + property alias changeScalePlayer1: changeScalePlayer1 + property alias rotateKonqi: rotateKonqi + + property alias player2: player2 + property alias secondInitial: secondInitial + property alias player2background: player2background.visible + property alias player2_score: player2_score.text + property alias player2turn: player2turn + property alias player2shrink: player2shrink + property alias player2image: player2image + property alias changeScalePlayer2: changeScalePlayer2 + property alias rotateTux: rotateTux + + property bool gameDone + property int counter + property int playSecond + property alias bar: bar + property alias bonus: bonus + } + + onStart: Activity.start(items, twoPlayer) + onStop: Activity.stop() + + Image { + id: board + source: Activity.url + "board.svg" + sourceSize.width: 3 * Math.min(background.width / 4 , background.height / 6) + visible: !items.isTutorial + anchors { + verticalCenter: parent.verticalCenter + horizontalCenter: parent.horizontalCenter + } + + MouseArea { + id: area + enabled: true + hoverEnabled: true + width: parent.width + height: parent.height + onClicked: {Activity.handleCreate(parent)} + } + } + + Rectangle { + id: firstInitial + anchors { + left: board.right + leftMargin: 0.05 * parent.width + top: board.top + topMargin: 15 + } + width: Math.min(0.9*parent.width - board.x - board.width, 0.65*board.width) + height: board.height/3 + visible: !items.isTutorial + opacity: 0.8 + radius: 10 + border.width: 2 + border.color: "black" + gradient: Gradient { + GradientStop { position: 0.0; color: "#6b4723" } + GradientStop { position: 0.9; color: "#996633" } + GradientStop { position: 1.0; color: "#AAA" } + } + + Image { + id: initialWhite + source: Activity.url + "white_piece.svg" + sourceSize.height: Math.min(parent.height*0.8,parent.width*0.4) + x: parent.width*0.06 + anchors.verticalCenter: parent.verticalCenter + } + + GCText { + id: whiteNumber + anchors { + verticalCenter: parent.verticalCenter + left: initialWhite.right + leftMargin: 7 + } + fontSize: initialWhite.height/2 + color: "white" + style: Text.Outline + styleColor: "black" + horizontalAlignment: Text.AlignHCenter + property int count: 9 + text: "X%1".arg(count) + } + + } + + Rectangle { + id: secondInitial + anchors { + left: board.right + leftMargin: 0.05 * parent.width + bottom: board.bottom + bottomMargin: 15 + } + width: Math.min(0.9*parent.width - board.x - board.width, 0.65*board.width) + height: board.height/3 + visible: !items.isTutorial + opacity: 0.8 + radius: 10 + border.width: 2 + border.color: "black" + gradient: Gradient { + GradientStop { position: 0.0; color: "#6b4723" } + GradientStop { position: 0.9; color: "#996633" } + GradientStop { position: 1.0; color: "#AAA" } + } + + Image { + id: initialBlack + source: Activity.url + "black_piece.svg" + sourceSize.height: Math.min(parent.height*0.8,parent.width*0.4) + x: parent.width*0.06 + anchors.verticalCenter: parent.verticalCenter + } + + GCText { + id: blackNumber + anchors { + verticalCenter: parent.verticalCenter + left: initialBlack.right + leftMargin: 7 + } + fontSize: initialBlack.height/2 + color: "white" + style: Text.Outline + styleColor: "black" + horizontalAlignment: Text.AlignHCenter + property int count: 9 + text: "X%1".arg(count) + } + + } + + // Tutorial section starts + Image { + id: previousTutorial + source: Activity.url + "bar_previous.svg" + sourceSize.height: skipTutorial.height*1.1 + visible: items.isTutorial && tutorialTxt.tutNum != 1 + anchors { + top: parent.top + topMargin: 5 + right: skipTutorialContainer.left + rightMargin: 5 + } + + MouseArea { + id: previousArea + width: parent.width + height: parent.height + onClicked: {Activity.tutorialPrevious()} + } + } + + Image { + id: nextTutorial + source: Activity.url + "bar_next.svg" + sourceSize.height: skipTutorial.height*1.1 + visible: items.isTutorial && tutorialTxt.tutNum != 5 + anchors { + top: parent.top + topMargin: 5 + left: skipTutorialContainer.right + leftMargin: 5 + } + + MouseArea { + id: nextArea + width: parent.width + height: parent.height + onClicked: {Activity.tutorialNext()} + } + } + + GCText { + id: skipTutorial + anchors { + horizontalCenter: parent.horizontalCenter + //left: parent.left + //leftMargin: 5 + top: parent.top + topMargin: 5 + } + fontSize: 12 //Math.min(parent.width/10, parent.height/2.5) + color: "white" + style: Text.Outline + styleColor: "black" + horizontalAlignment: Text.AlignHCenter + width: Math.min(implicitWidth, 0.8*parent.width ) + wrapMode: TextEdit.WordWrap + visible: items.isTutorial + text: qsTr("Skip Tutorial") + z: 2 + } + + Rectangle { + id: skipTutorialContainer + anchors.top: skipTutorial.top + anchors.horizontalCenter: skipTutorial.horizontalCenter + width: skipTutorial.width + 10 + height: skipTutorial.fontSize * 2.28 * Math.ceil(skipTutorial.implicitWidth / skipTutorial.width) + opacity: 0.8 + radius: 10 + border.width: 2 + border.color: "black" + visible: items.isTutorial + gradient: Gradient { + GradientStop { position: 0.0; color: "#000" } + GradientStop { position: 0.9; color: "#666" } + GradientStop { position: 1.0; color: "#AAA" } + } + MouseArea { + id: skipArea + hoverEnabled: true + width: parent.width + height: parent.height + onEntered: {skipTutorialContainer.border.color = "#62db53"} + onExited: {skipTutorialContainer.border.color = "black"} + onClicked: {Activity.tutorialSkip()} + } + } + + GCText { + id: tutorialTxt + anchors { + horizontalCenter: parent.horizontalCenter + //left: parent.left + //leftMargin: 5 + top: skipTutorial.bottom + topMargin: skipTutorial.height*0.5 + } + fontSize: 13 //Math.min(parent.width/10, parent.height/2.5) + color: "white" + style: Text.Outline + styleColor: "black" + horizontalAlignment: Text.AlignHLeft + width: Math.min(implicitWidth, 0.8*parent.width )//, textWidth * tutorialTxt.parent.width) + wrapMode: TextEdit.WordWrap + visible: items.isTutorial + text: "Tutorial" + z: 2 + property int tutNum: 1 + + /* + function changeTutorialText() { + if (tutNum == 1) { + text = qsTr("Each player starts with 9 pieces. Initially, they take turns to \ + place all their 9 peices onto the empty spots on the board.") + } + } + */ + } + + Rectangle { + id: tutorialTxtContainer + anchors.top: tutorialTxt.top + anchors.horizontalCenter: tutorialTxt.horizontalCenter + width: tutorialTxt.width + 20 + height: tutorialTxt.fontSize * 2.5 * Math.ceil(tutorialTxt.implicitWidth / tutorialTxt.width) + opacity: 0.8 + radius: 10 + border.width: 2 + border.color: "black" + visible: items.isTutorial + gradient: Gradient { + GradientStop { position: 0.0; color: "#000" } + GradientStop { position: 0.9; color: "#666" } + GradientStop { position: 1.0; color: "#AAA" } + } + } + + Image { + id: tutorialImage + source: Activity.url + "tutorial" + tutorialTxt.tutNum + ".svg" + property int heightNeed: background.height - tutorialTxtContainer.height - bar.height - 4*skipTutorialContainer.height + //sourceSize.height: Math.min(background.height - tutorialTxtContainer.height - 1.2*bar.height - 2*skipTutorial.height, 0.5*background.width) + //sourceSize.width: background.width + //height: sourceSize.height >= sourceSize.width ? heightNeed : 0.5*background.width //heightNeed*parent.width/sourceSize.width + width: (sourceSize.width/sourceSize.height) > (0.9*background.width/heightNeed) ? 0.9*background.width : + (sourceSize.width*heightNeed)/sourceSize.height + fillMode: Image.PreserveAspectFit + visible: items.isTutorial + anchors { + top: tutorialTxt.bottom + topMargin: 10 + //bottom: bar.top + //bottomMargin: 10 + horizontalCenter: parent.horizontalCenter + } + } + // Tutorial section ends + + PropertyAnimation { + id: player1turn + target: changeScalePlayer1 + properties: "scale" + from: 1.0 + to: 1.4 + duration: 500 + onStarted:{ + player1.state = "first" + player2.state = "second" + rotateTux.stop() + player2image.rotation = 0 + rotateKonqi.start() + player2shrink.start() + } + onStopped: {Activity.shouldComputerPlay()} + } + + PropertyAnimation { + id: player1shrink + target: changeScalePlayer1 + properties: "scale" + from: 1.4 + to: 1.0 + duration: 500 + } + + PropertyAnimation { + id: player2turn + target: changeScalePlayer2 + properties: "scale" + from: 1.0 + to: 1.4 + duration: 500 + onStarted:{ + player1.state = "second" + player2.state = "first" + rotateKonqi.stop() + player1image.rotation = 0 + rotateTux.start() + player1shrink.start() + } + onStopped: {Activity.shouldComputerPlay()} + } + + PropertyAnimation { + id: player2shrink + target: changeScalePlayer2 + properties: "scale" + from: 1.4 + to: 1.0 + duration: 500 + } + + SequentialAnimation { + id: rotateKonqi + loops: Animation.Infinite + NumberAnimation { + target: player1image + property: "rotation" + from: -30; to: 30 + duration: 750 + easing.type: Easing.InOutQuad + } + NumberAnimation { + target: player1image + property: "rotation" + from: 30; to: -30 + duration: 750 + easing.type: Easing.InOutQuad + } + } + + SequentialAnimation { + id: rotateTux + loops: Animation.Infinite + NumberAnimation { + target: player2image + property: "rotation" + from: -30; to: 30 + duration: 750 + easing.type: Easing.InOutQuad + } + NumberAnimation { + target: player2image + property: "rotation" + from: 30; to: -30 + duration: 750 + easing.type: Easing.InOutQuad + } + } + + Rectangle { + id: player2 + height: Math.min(background.height/7,Math.min(background.width/7,bar.height * 1.05)) + width: height*11/8 + anchors { + top: background.top + topMargin: 5 + right: background.right + rightMargin: 5 + } + radius: 5 + state: "second" + visible: !items.isTutorial + + Image { + id: player2background + source: Activity.url + "score_2.svg" + sourceSize.height: parent.height*0.93 + anchors.centerIn: parent + + Image { + id: player2image + source: Activity.url + "TuxBlack.svg" + sourceSize.height: parent.height*0.8 + x: parent.width*0.06 + anchors.verticalCenter: parent.verticalCenter + } + + GCText { + id: player2_score + anchors.verticalCenter: parent.verticalCenter + x: parent.width*0.65 + color: "#2a2a2a" + fontSize: largeSize + } + } + + states: [ + State { + name: "first" + PropertyChanges { + target: player2image + source: Activity.url + "TuxBlack.svg" + } + PropertyChanges { + target: player2 + color: "#49bbf0" + } + }, + State { + name: "second" + PropertyChanges { + target: player2 + color: "transparent" + } + PropertyChanges { + target: player2image + source: Activity.url + "TuxBlack.svg" + } + }, + State { + name: "win" + PropertyChanges { + target: player2image + source: Activity.url + "win.svg" + } + PropertyChanges { + target: player2 + color: "#f7ec5d" + } + } + ] + + transform: Scale { + id: changeScalePlayer2 + property real scale: 1 + origin.x: player2.width + origin.y: 0 + xScale: scale + yScale: scale + } + } + + Rectangle { + id: player1 + height: Math.min(background.height/7,Math.min(background.width/7,bar.height * 1.05)) + width: height*11/8 + anchors { + top: background.top + topMargin: 5 + left: background.left + leftMargin: 5 + } + radius: 5 + state: "second" + visible: !items.isTutorial + + Image { + id: player1background + source: Activity.url + "score_1.svg" + sourceSize.height: parent.height*0.93 + anchors.centerIn: parent + anchors.horizontalCenterOffset: 0.5 + + Image { + id: player1image + source: Activity.url + "KonqiWhite.svg" + sourceSize.height: parent.height*0.8 + x: parent.width*0.06 + anchors.verticalCenter: parent.verticalCenter + } + + GCText { + id: player1_score + anchors.verticalCenter: parent.verticalCenter + color: "#2a2a2a" + x: parent.width*0.65 + fontSize: largeSize + } + } + + states: [ + State { + name: "first" + PropertyChanges { + target: player1image + source: Activity.url + "KonqiWhite.svg" + } + PropertyChanges { + target: player1 + color: "#f07c49" + } + }, + State { + name: "second" + PropertyChanges { + target: player1 + color: "transparent" + } + PropertyChanges { + target: player1image + source: Activity.url + "KonqiWhite.svg" + } + }, + State { + name: "win" + PropertyChanges { + target: player1image + source: Activity.url + "win.svg" + } + PropertyChanges { + target: player1 + color: "#f7ec5d" + } + } + ] + + transform: Scale { + id: changeScalePlayer1 + property real scale: 1 + xScale: scale + yScale: scale + } + } + + DialogHelp { + id: dialogHelp + onClose: home() + } + + Bar { + id: bar + content: BarEnumContent { value: (twoPlayer ? (help | home | reload) : (help | home | level | reload))} + onHelpClicked: { + displayDialog(dialogHelp) + } + onPreviousLevelClicked: Activity.previousLevel() + onNextLevelClicked: Activity.nextLevel() + onHomeClicked: activity.home() + onReloadClicked: { + Activity.reset() + } + } + + Bonus { + id: bonus + Component.onCompleted: win.connect(Activity.nextLevel) + } + } + +} diff --git a/src/activities/nine_men_morris/Piece.qml b/src/activities/nine_men_morris/Piece.qml new file mode 100644 index 000000000..b624e08d7 --- /dev/null +++ b/src/activities/nine_men_morris/Piece.qml @@ -0,0 +1,56 @@ +/* GCompris - Piece.qml + * + * Copyright (C) 2016 Pulkit Gupta + * + * Authors: + * Pulkit 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.1 + +import "../../core" +import "nine_men_morris.js" as Activity + +import GCompris 1.0 + +Image { + id: piece + + opacity: 1.0 + + states: [ + State { + name: "invisible" + PropertyChanges { + target: piece + opacity: 0 + } + }, + State { + name: "1" // Player 1 + PropertyChanges{ + target: piece + source: Activity.url + "white_piece.svg" + } + }, + State { + name: "2" // Player 2 + PropertyChanges { + target: piece + source: Activity.url + "black_piece.svg" + } + } + ] +} diff --git a/src/activities/nine_men_morris/nine_men_morris.js b/src/activities/nine_men_morris/nine_men_morris.js new file mode 100644 index 000000000..c5bef1c4a --- /dev/null +++ b/src/activities/nine_men_morris/nine_men_morris.js @@ -0,0 +1,240 @@ +/* GCompris - nine_men_morris.js + * + * Copyright (C) 2016 Pulkit Gupta + * + * Authors: + * Pulkit 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 . + */ +.pragma library +.import QtQuick 2.0 as Quick + +var currentLevel = 0 +var numberOfLevel = 5 +var items + +var url = "qrc:/gcompris/src/activities/nine_men_morris/resource/" + +//var currentPiece +var currentPlayer +var currentLocation +var twoPlayer +var track = [] //For tracking moves +var stopper //For stopping game when doing reset + +function start(items_, twoPlayer_) { + + items = items_ + currentLevel = 1 + currentPlayer = 1 + items.player1_score = 0 + items.player2_score = 0 + twoPlayer = twoPlayer_ + numberOfLevel = 6 + items.playSecond = 0 + if (!twoPlayer) + tutorial() + else + initLevel() +} + +function stop() { +} + +function initLevel() { + items.bar.level = currentLevel + items.counter = 0 + items.gameDone = false + items.board.anchors.horizontalCenterOffset = -0.25*items.board.width + items.board.sourceSize.width = 3 * Math.min(items.background.width / 4 , items.background.height / 6) + //items.pieces.clear() + track = [] + /*for(var y = 0; y < items.rows; y++) { + for(var x = 0; x < items.columns; x++) { + items.pieces.append({'stateTemp': "invisible"}) + } + }*/ + if (items.playSecond) + initiatePlayer2() + else + initiatePlayer1() + stopper = 0 + if (items.playSecond) + changePlayToSecond() +} + +function tutorial() { + items.isTutorial = true + /* + items.board.anchors.horizontalCenterOffset = -0.25*items.board.width + //items.board.anchors.verticalCenterOffset = 0.25*items.board.height + items.board.anchors.verticalCenter = undefined + items.board.anchors.bottom = items.bar.top + items.board.anchors.bottomMargin = 20 + items.board.sourceSize.width = 2 * Math.min(items.background.width / 4 , items.background.height / 6) + */ + setTutorial(1) +} + +function setTutorial(tutNum) { + //var src = "tutorial" + tutNum + ".svg" + //items.tutorialImage = url + src + if (tutNum == 1) { + items.tutorialTxt = qsTr("You and Tux starts with 9 pieces each, and take turns to place " + + "your pieces on to the empty spots (by clicking on the spots) on the board. ") + } + else if (tutNum == 2) { + items.tutorialTxt = qsTr("If you form a mill (line of 3 pieces), then select a piece of Tux, and remove " + + "it. Pieces of formed mill can not be removed unless no other pieces are left on board.") + } + else if (tutNum == 3) { + items.tutorialTxt = qsTr("After all the pieces are placed, you and Tux will take turns to move them. " + + "Click on one of your pieces, and then on the adjacent empty spot to move " + + "it there. Green color spot indicates where you can move.") + } + else if (tutNum == 4) { + items.tutorialTxt = qsTr("If you are left with 3 pieces, your pieces will gain the ability to 'fly' " + + "and can be moved to any vacant spot on the board.") + } + else if (tutNum == 5) { + items.tutorialTxt = qsTr("If you immobilize the computer or leave it with less than 3 pieces, then " + + "you win the game.") + } + /* + else { + items.isTutorial = false + initLevel() + }*/ +} + +function tutorialNext() { + setTutorial(++items.tutNum) +} + +function tutorialPrevious() { + setTutorial(--items.tutNum) +} + +function tutorialSkip() { + items.isTutorial = false + initLevel() +} + +function nextLevel() { + if(numberOfLevel <= ++currentLevel ) { + currentLevel = 1 + } + reset(); +} + +function previousLevel() { + if(--currentLevel < 1) { + currentLevel = numberOfLevel - 1 + } + reset(); +} + +function reset() { + + stopper = 1 + stopAnimations() + items.player1image.rotation = 0 + items.player2image.rotation = 0 + if (items.playSecond) + items.playSecond = 0 + else + items.playSecond = 1 + initLevel() +} + +function stopAnimations() { + + items.player1turn.stop() + items.player2turn.stop() + items.player1shrink.stop() + items.player2shrink.stop() + items.rotateKonqi.stop() + items.rotateTux.stop() +} + +//Initial values at the start of game when its player 1 turn +function initiatePlayer1() { + + items.changeScalePlayer1.scale = 1.4 + items.changeScalePlayer2.scale = 1.0 + items.player1.state = "first" + items.player2.state = "second" + items.rotateKonqi.start() +} + +//Initial values at the start of game when its player 1 turn +function initiatePlayer2() { + + items.changeScalePlayer1.scale = 1.0 + items.changeScalePlayer2.scale = 1.4 + items.player1.state = "second" + items.player2.state = "first" + items.rotateTux.start() +} + +//Change scale of score boxes according to turns +function changeScale() { + + if (items.playSecond) { + if (items.counter%2 == 0) + items.player2turn.start() + else + items.player1turn.start() + } + else { + if (items.counter%2 == 0) + items.player1turn.start() + else + items.player2turn.start() + } +} + +function changePlayToSecond() { + if (items.playSecond == 0) { + items.playSecond = 1 + reset() + return 0 + } + if (!twoPlayer) { + } +} + +//Changing play to second in single player mode +function changePlayToFirst() { + items.playSecond = 0 + reset() +} + +//Create the piece at given position +function handleCreate(parent) { + + items.firstInitial.visible = false + items.secondInitial.visible = false + items.board.anchors.horizontalCenterOffset = 0 + //items.board.anchors.verticalCenterOffset = -10 + items.board.sourceSize.width = 3.4 * Math.min(items.background.width / 4 , items.background.height / 6) + +} + +function setmove() { +} + +function shouldComputerPlay() { +} diff --git a/src/activities/nine_men_morris/nine_men_morris.svg b/src/activities/nine_men_morris/nine_men_morris.svg new file mode 100644 index 000000000..87f525501 --- /dev/null +++ b/src/activities/nine_men_morris/nine_men_morris.svg @@ -0,0 +1,976 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2009-05-28T22:36:41 + The board setout of Nine Men's Morris. + https://openclipart.org/detail/26344/nine-mens-morris-by-chovynz + + + chovynz + + + + + black and white + game + line art + morris + nine + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/KonqiWhite.svg b/src/activities/nine_men_morris/resource/KonqiWhite.svg new file mode 100644 index 000000000..5772473e0 --- /dev/null +++ b/src/activities/nine_men_morris/resource/KonqiWhite.svg @@ -0,0 +1,365 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/README b/src/activities/nine_men_morris/resource/README new file mode 100644 index 000000000..6a5e0d80a --- /dev/null +++ b/src/activities/nine_men_morris/resource/README @@ -0,0 +1,10 @@ +background.svg: Contains 2 types of trees whch are taken from + https://openclipart.org/detail/9471/RPG map symbols: tree + This work is licensed under the Unlimited Commercial Use License. + https://openclipart.org/detail/9469/RPG map symbols: tree + This work is licensed under the Unlimited Commercial Use License. + +win.svg: Taken from https://openclipart.org/detail/48937/Trophy + This work is licensed under the Unlimited Commercial Use License. + + diff --git a/src/activities/nine_men_morris/resource/TuxBlack.svg b/src/activities/nine_men_morris/resource/TuxBlack.svg new file mode 100644 index 000000000..e27d03239 --- /dev/null +++ b/src/activities/nine_men_morris/resource/TuxBlack.svg @@ -0,0 +1,360 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/background.svg b/src/activities/nine_men_morris/resource/background.svg new file mode 100644 index 000000000..e65a710b3 --- /dev/null +++ b/src/activities/nine_men_morris/resource/background.svg @@ -0,0 +1,366 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/bar_next.svg b/src/activities/nine_men_morris/resource/bar_next.svg new file mode 100644 index 000000000..cb1b3f345 --- /dev/null +++ b/src/activities/nine_men_morris/resource/bar_next.svg @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/bar_previous.svg b/src/activities/nine_men_morris/resource/bar_previous.svg new file mode 100644 index 000000000..86bd2cb14 --- /dev/null +++ b/src/activities/nine_men_morris/resource/bar_previous.svg @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/black_piece.svg b/src/activities/nine_men_morris/resource/black_piece.svg new file mode 100644 index 000000000..2e2f4b536 --- /dev/null +++ b/src/activities/nine_men_morris/resource/black_piece.svg @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/board.svg b/src/activities/nine_men_morris/resource/board.svg new file mode 100644 index 000000000..b117727e8 --- /dev/null +++ b/src/activities/nine_men_morris/resource/board.svg @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Nine Men's Morris + 2009-05-28T22:36:41 + The board setout of Nine Men's Morris. + https://openclipart.org/detail/26344/nine-mens-morris-by-chovynz + + + chovynz + + + + + black and white + game + line art + morris + nine + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/click.wav b/src/activities/nine_men_morris/resource/click.wav new file mode 100644 index 000000000..f93e71f28 Binary files /dev/null and b/src/activities/nine_men_morris/resource/click.wav differ diff --git a/src/activities/nine_men_morris/resource/score_1.svg b/src/activities/nine_men_morris/resource/score_1.svg new file mode 100644 index 000000000..1a1d6f8d9 --- /dev/null +++ b/src/activities/nine_men_morris/resource/score_1.svg @@ -0,0 +1,64 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/score_2.svg b/src/activities/nine_men_morris/resource/score_2.svg new file mode 100644 index 000000000..062f66c14 --- /dev/null +++ b/src/activities/nine_men_morris/resource/score_2.svg @@ -0,0 +1,64 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/tutorial1.svg b/src/activities/nine_men_morris/resource/tutorial1.svg new file mode 100644 index 000000000..e7d01b219 --- /dev/null +++ b/src/activities/nine_men_morris/resource/tutorial1.svg @@ -0,0 +1,533 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + X9 + + + + + + + + + + + + + + X9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2009-05-28T22:36:41 + The board setout of Nine Men's Morris. + https://openclipart.org/detail/26344/nine-mens-morris-by-chovynz + + + chovynz + + + + + black and white + game + line art + morris + nine + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/tutorial2.svg b/src/activities/nine_men_morris/resource/tutorial2.svg new file mode 100644 index 000000000..61def3196 --- /dev/null +++ b/src/activities/nine_men_morris/resource/tutorial2.svg @@ -0,0 +1,927 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2009-05-28T22:36:41 + The board setout of Nine Men's Morris. + https://openclipart.org/detail/26344/nine-mens-morris-by-chovynz + + + chovynz + + + + + black and white + game + line art + morris + nine + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/tutorial3.svg b/src/activities/nine_men_morris/resource/tutorial3.svg new file mode 100644 index 000000000..87f525501 --- /dev/null +++ b/src/activities/nine_men_morris/resource/tutorial3.svg @@ -0,0 +1,976 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2009-05-28T22:36:41 + The board setout of Nine Men's Morris. + https://openclipart.org/detail/26344/nine-mens-morris-by-chovynz + + + chovynz + + + + + black and white + game + line art + morris + nine + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/tutorial4.svg b/src/activities/nine_men_morris/resource/tutorial4.svg new file mode 100644 index 000000000..361e1eebc --- /dev/null +++ b/src/activities/nine_men_morris/resource/tutorial4.svg @@ -0,0 +1,924 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2009-05-28T22:36:41 + The board setout of Nine Men's Morris. + https://openclipart.org/detail/26344/nine-mens-morris-by-chovynz + + + chovynz + + + + + black and white + game + line art + morris + nine + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/tutorial5.svg b/src/activities/nine_men_morris/resource/tutorial5.svg new file mode 100644 index 000000000..6db344523 --- /dev/null +++ b/src/activities/nine_men_morris/resource/tutorial5.svg @@ -0,0 +1,1519 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2009-05-28T22:36:41 + The board setout of Nine Men's Morris. + https://openclipart.org/detail/26344/nine-mens-morris-by-chovynz + + + chovynz + + + + + black and white + game + line art + morris + nine + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/white_piece.svg b/src/activities/nine_men_morris/resource/white_piece.svg new file mode 100644 index 000000000..8bcce749e --- /dev/null +++ b/src/activities/nine_men_morris/resource/white_piece.svg @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/src/activities/nine_men_morris/resource/win.svg b/src/activities/nine_men_morris/resource/win.svg new file mode 100644 index 000000000..a6bba05eb --- /dev/null +++ b/src/activities/nine_men_morris/resource/win.svg @@ -0,0 +1,257 @@ + + + + + Trophy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Trophy + 2010-04-19T17:11:15 + A Trophy + https://openclipart.org/detail/48937/trophy-by-sheikh_tuhin + + + sheikh_tuhin + + + + + award + celebration + prize + trophy + + + + + + + + + + +