Changeset View
Changeset View
Standalone View
Standalone View
src/activities/planegame/planegame.js
Show All 35 Lines | |||||
36 | var upPressed | 36 | var upPressed | ||
37 | var downPressed | 37 | var downPressed | ||
38 | var leftPressed | 38 | var leftPressed | ||
39 | var rightPressed | 39 | var rightPressed | ||
40 | 40 | | |||
41 | var items | 41 | var items | ||
42 | var dataset | 42 | var dataset | ||
43 | 43 | | |||
44 | /*var tutorialInstructions = [ | ||||
jjazeix: these are specific to numbers-odd-even activity, the instructions should be on its folder (you… | |||||
45 | { | ||||
46 | "instruction": qsTr("This activity teaches about even and odd numbers."), | ||||
47 | "instructionQml": "" | ||||
48 | }, | ||||
49 | { | ||||
50 | "instruction": qsTr("Even numbers are numbers which leave remainder 0 when divisible by 2."), | ||||
51 | "instructionQml" : "qrc:/gcompris/src/activities/numbers-odd-even/resource/tutorial1.qml" | ||||
52 | }, | ||||
53 | { | ||||
54 | "instruction": qsTr("Odd numbers are numbers which do not leave remainder 0 when divisible by 2."), | ||||
55 | "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/tutorial2.qml" | ||||
56 | }, | ||||
57 | { | ||||
58 | "instruction": qsTr("Exercise: \n To test your understanding."), | ||||
59 | "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/tutorial3.qml" | ||||
60 | }, | ||||
61 | { | ||||
62 | "instruction": qsTr("Exercise: \n To test your understanding."), | ||||
63 | "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/tutorial4.qml" | ||||
64 | }, | ||||
65 | { | ||||
66 | "instruction": qsTr("Exercise \n To test your understanding."), | ||||
67 | "instructionQml": "qrc:/gcompris/src/activities/numbers-odd-even/resource/tutorial5.qml" | ||||
68 | } | ||||
69 | | ||||
70 | ]*/ | ||||
71 | | ||||
72 | | ||||
44 | var cloudComponent = Qt.createComponent(url + "Cloud.qml"); | 73 | var cloudComponent = Qt.createComponent(url + "Cloud.qml"); | ||
45 | var clouds = new Array; | 74 | var clouds = new Array; | ||
46 | var cloudsErased = new Array; | 75 | var cloudsErased = new Array; | ||
47 | 76 | | |||
48 | function start(items_, dataset_) { | 77 | function start(items_, dataset_) { | ||
49 | Core.checkForVoices(items_.background); | 78 | Core.checkForVoices(items_.background); | ||
50 | 79 | | |||
51 | items = items_ | 80 | items = items_ | ||
52 | dataset = dataset_ | 81 | dataset = dataset_ | ||
53 | numberOfLevel = dataset.length | 82 | numberOfLevel = dataset.length | ||
54 | currentLevel = 0 | 83 | currentLevel = 0 | ||
55 | initLevel() | 84 | initLevel() | ||
jjazeix: indentation | |||||
56 | } | 85 | } | ||
57 | 86 | | |||
58 | function stop() { | 87 | function stop() { | ||
59 | cloudDestroy(clouds) | 88 | cloudDestroy(clouds) | ||
60 | cloudDestroy(cloudsErased) | 89 | cloudDestroy(cloudsErased) | ||
61 | items.movePlaneTimer.stop() | 90 | items.movePlaneTimer.stop() | ||
62 | items.cloudCreation.stop() | 91 | items.cloudCreation.stop() | ||
63 | } | 92 | } | ||
Show All 36 Lines | 104 | function initLevel() { | |||
100 | createCloud() | 129 | createCloud() | ||
101 | } | 130 | } | ||
102 | 131 | | |||
103 | function nextLevel() { | 132 | function nextLevel() { | ||
104 | if(numberOfLevel <= ++currentLevel) { | 133 | if(numberOfLevel <= ++currentLevel) { | ||
105 | currentLevel = 0 | 134 | currentLevel = 0 | ||
106 | } | 135 | } | ||
107 | 136 | | |||
108 | initLevel(); | 137 | initLevel(); | ||
jjazeix: indentation | |||||
109 | } | 138 | } | ||
110 | 139 | | |||
111 | function previousLevel() { | 140 | function previousLevel() { | ||
112 | if(--currentLevel < 0) { | 141 | if(--currentLevel < 0) { | ||
113 | currentLevel = numberOfLevel - 1 | 142 | currentLevel = numberOfLevel - 1 | ||
114 | } | 143 | } | ||
115 | initLevel(); | 144 | initLevel(); | ||
jjazeix: indentation | |||||
116 | } | 145 | } | ||
117 | 146 | | |||
118 | function repositionObjectsOnWidthChanged(factor) { | 147 | function repositionObjectsOnWidthChanged(factor) { | ||
119 | if(items && items.plane) { | 148 | if(items && items.plane) { | ||
120 | items.movePlaneTimer.interval = 1000 | 149 | items.movePlaneTimer.interval = 1000 | ||
121 | items.plane.state = "init" | 150 | items.plane.state = "init" | ||
122 | } | 151 | } | ||
123 | for(var i = clouds.length - 1; i >= 0 ; --i) { | 152 | for(var i = clouds.length - 1; i >= 0 ; --i) { | ||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |
these are specific to numbers-odd-even activity, the instructions should be on its folder (you can put them in the qml)