Browse Source

Renamed variables
Updated lang files

laira 3 years ago
parent
commit
bf1342d7e6
12 changed files with 218 additions and 235 deletions
  1. 10 12
      assets/lang/en_US
  2. 10 12
      assets/lang/es_PE
  3. 10 12
      assets/lang/fr_FR
  4. 10 12
      assets/lang/it_IT
  5. 10 12
      assets/lang/pt_BR
  6. 33 36
      js/circleOne.js
  7. 43 43
      js/globals.js
  8. 6 6
      js/map.js
  9. 27 27
      js/menu.js
  10. 50 51
      js/squareOne.js
  11. 6 9
      js/squareTwo.js
  12. 3 3
      php/README.md

+ 10 - 12
assets/lang/en_US

@@ -1,27 +1,25 @@
 audio=AUDIO
-box_guide=Auxiliar Rectangles
-circle_name=Circles
+aux_rectangle=Auxiliar Rectangles
+circle=Circles
 continue=Continue
 custom_game=CUSTOMIZE THE CURRENT GAME
 difficulty=Difficulties
 empty_name=You forgot to type your name
-error_msg=You should select a smaller portion than it's full size
+s2_error_msg=You should select a smaller portion than it's full size
 game=GAME
-game_menu_title=SELECT OPERATION AND DIFFICULTY
+game_mode=Game Modes
 good_job=Good Job
 insert_name=ENTER YOUR NAME
-label_name=labels
-level=Game Modes
 loading=LOADING
-menu_back=GO BACK
-menu_help=SEE SOLUTION
-menu_list=MAIN MENU
 menu_title=SELECT GAME
-menu_world=LANGUAGE SELECTION
+nav_back=GO BACK
+nav_help=SEE SOLUTION
+nav_menu=MAIN MENU
+nav_lang=LANGUAGE SELECTION
+operation=Operations
 ready=READY
 retry=Try again
 show=Show
-square_name=Quadrangles
-sublevel=Operations
+square=Quadrangles
 title=Fractions
 welcome=Hi

+ 10 - 12
assets/lang/es_PE

@@ -1,27 +1,25 @@
 audio=AUDIO
-box_guide=Rectángulos Auxiliares
-circle_name=Circulos
+aux_rectangle=Rectángulos Auxiliares
+circle=Circulos
 continue=Continúa
 custom_game=PERSONALIZAR EL JUEGO ACTUAL
 difficulty=Dificultades
 empty_name=Usted ha olvidado de escribir su nombre
-error_msg=Debes seleccionar una porción más pequeña que su tamaño completo
+s2_error_msg=Debes seleccionar una porción más pequeña que su tamaño completo
 game=JUEGO
-game_menu_title=SELECCIONA LA OPERACION Y DIFICULTAD
+game_mode=Modos de Juego
 good_job=Bien hecho
 insert_name=INGRESA TU NOMBRE
-label_name=etiquetas
-level=Modos de Juego
 loading=CARGANDO
-menu_back=REGRESAR
-menu_help=VER SOLUCION
-menu_list=MENU PRINCIPAL
 menu_title=SELECCIONE UN JUEGO
-menu_world=SELECCION DE IDIOMA
+nav_back=REGRESAR
+nav_help=VER SOLUCION
+nav_menu=MENU PRINCIPAL
+nav_lang=SELECCION DE IDIOMA
+operation=Operaciones
 ready=LISTO
 retry=Inténtalo de nuevo
 show=Mostrar
-square_name=Cuadrilateros
-sublevel=Operaciones
+square=Cuadrilateros
 title=Fracciones
 welcome=Hola

+ 10 - 12
assets/lang/fr_FR

@@ -1,27 +1,25 @@
 audio=AUDIO
-box_guide=Rectangles Auxiliaires
-circle_name=Cercles
+aux_rectangle=Rectangles Auxiliaires
+circle=Cercles
 continue=Continuez
 custom_game=PERSONNALISER LE JEU ACTUEL
 difficulty=Difficultés
 empty_name=Vous avez oublié de taper votre nom
-error_msg=Vous devriez choisir une portion plus petite que sa taille totale
+s2_error_msg=Vous devriez choisir une portion plus petite que sa taille totale
 game=JEU
-game_menu_title=SÉLECTIONNEZ L'OPÉRATION ET LA DIFFICULTÉ
+game_mode=Modes de Jeu
 good_job=Bon travail
 insert_name=ENTREZ VOTRE NOM
-label_name=étiquettes
-level=Modes de Jeu
 loading=CHARGEMENT
-menu_back=REVENIR
-menu_help=VOIR LA SOLUTION
-menu_list=MENU PRINCIPAL
 menu_title=SÉLECTIONNEZ UN JEU
-menu_world=SÉLECTIONNEZ UNE LANGUE
+nav_back=REVENIR
+nav_help=VOIR LA SOLUTION
+nav_menu=MENU PRINCIPAL
+nav_lang=SÉLECTIONNEZ UNE LANGUE
+operation=Opérations
 ready=PRÊT
 retry=Réessayer
 show=Afficher les
-square_name=Quadrangles
-sublevel=Opérations
+square=Quadrangles
 title=Fractions
 welcome=Salut

+ 10 - 12
assets/lang/it_IT

@@ -1,27 +1,25 @@
 audio=AUDIO
-box_guide=Rettangoli Ausiliari
-circle_name=Cerchi
+aux_rectangle=Rettangoli Ausiliari
+circle=Cerchi
 continue=Continua
 custom_game=PERSONALIZZA IL GIOCO ATTUALE
 difficulty=Difficoltá
 empty_name=Ti sei dimenticato di digitare il tuo nome
-error_msg=Devi scegliere una porzione minore della grandezza totale
+s2_error_msg=Devi scegliere una porzione minore della grandezza totale
 game=GIOCO
-game_menu_title=SELEZIONARE UNA OPERAZIONE E UNA DIFFICOLTÁ
+game_mode=Modalità di Gioco
 good_job=Buon lavoro
 insert_name=SCRIVI IL TUO NOME
-label_name=legendas
-level=Modalità di Gioco
 loading=CARICANDO
-menu_back=INDIETRO
-menu_help=GUARDA SOLUZIONE
-menu_list=MENÚ PRINCIPALE
 menu_title=SELEZIONA UN GRIOCO
-menu_world=SELEZIONARE IDIOMA
+nav_back=INDIETRO
+nav_help=GUARDA SOLUZIONE
+nav_menu=MENÚ PRINCIPALE
+nav_lang=SELEZIONARE IDIOMA
+operation=Operazioni
 ready=OK
 retry=Tenta di nuovo
 show=Mostra le
-square_name=Quadrilateri
-sublevel=Operazioni
+square=Quadrilateri
 title=Frazioni
 welcome=Ciao

+ 10 - 12
assets/lang/pt_BR

@@ -1,27 +1,25 @@
 audio=ÁUDIO
-box_guide=Retângulos Auxiliares
-circle_name=Círculos
+aux_rectangle=Retângulos Auxiliares
+circle=Círculos
 continue=Continue
 custom_game=PERSONALIZE O JOGO ATUAL
 difficulty=Dificuldades
 empty_name=Você esqueceu de digitar seu nome
-error_msg=Você deve selecionar uma porção menor que o seu tamanho total
+s2_error_msg=Você deve selecionar uma porção menor que o seu tamanho total
 game=JOGO
-game_menu_title=SELECIONAR OPERAÇÃO E DIFICULDADE
+game_mode=Modos de Jogo
 good_job=Bom trabalho
 insert_name=DIGITE SEU NOME
-label_name=legendas
-level=Modos de Jogo
 loading=CARREGANDO
-menu_back=VOLTAR
-menu_help=VER SOLUÇÃO
-menu_list=MENU PRINCIPAL
 menu_title=SELECIONE UM JOGO
-menu_world=SELECIONAR IDIOMA
+nav_back=VOLTAR
+nav_help=VER SOLUÇÃO
+nav_menu=MENU PRINCIPAL
+nav_lang=SELECIONAR IDIOMA
+operation=Operações
 ready=PRONTO
 retry=Tente novamente
 show=Mostrar
-square_name=Quadriláteros
-sublevel=Operações
+square=Quadriláteros
 title=Frações
 welcome=Olá

+ 33 - 36
js/circleOne.js

@@ -1,28 +1,25 @@
 /**
- *
  * LInE - Free Education, Private Data
  *
  * iFractions GAME STATE
  *
- * LEVELS - CIRCLE I & II: balloon level
- *
  * Name of game state : 'circleOne'
  * Shape : circle
  * Character : kid/balloon
- * Theme : flying a balloon
+ * Theme : flying in a balloon
  * Concept : 'How much the kid has to walk to get to the balloon?'
  * Represent fractions as : circles
  *
- * # of different difficulties for each level : 5
+ * # of different difficulties : 5
  *
- * Levels can be : 'A' or 'B' (in variable 'levelType')
+ * Game modes can be : 'A' or 'B' (in variable 'gameModeType')
  *
  *   A : Player can place balloon position
  *       Place balloon in position (so the kid can get to it)
  *   B : Player can select # of circles
  *       Selects number of circles (that represent distance kid needs to walk to get to the balloon)
  *
- * Sublevels can be : 'Plus', 'Minus' or 'Mixed' (in variable 'sublevelType')
+ * Operations can be : 'Plus', 'Minus' or 'Mixed' (in variable 'gameOperationType')
  *
  *   Plus : addition of fractions
  *     Represented by : kid going to the right (floor positions 0..5)
@@ -53,7 +50,7 @@ const circleOne = {
 
     let hasBaseDifficulty = false; // Will validate that level isnt too easy (has at least one '1/difficulty' fraction)
 
-    const startX = (sublevelType == 'Minus') ? 66 + 5 * 156 : 66;  // Initial 'x' coordinate for the kid and the baloon
+    const startX = (gameOperationType == 'Minus') ? 66 + 5 * 156 : 66;  // Initial 'x' coordinate for the kid and the baloon
     this.correctX = startX; // Ending position, accumulative
 
     // BACKGROUND
@@ -107,16 +104,16 @@ const circleOne = {
     this.balloonPlace = defaultWidth / 2; // Balloon place
 
     // Number of circles
-    const max = (sublevelType == 'Mixed' || levelType == 'B') ? 6 : mapPosition + 1;
-    const min = (sublevelType == 'Mixed' && mapPosition < 2) ? 2 : mapPosition; // Mixed level has at least 2 fractions
+    const max = (gameOperationType == 'Mixed' || gameModeType == 'B') ? 6 : mapPosition + 1;
+    const min = (gameOperationType == 'Mixed' && mapPosition < 2) ? 2 : mapPosition; // Mixed level has at least 2 fractions
     const total = game.math.randomInRange(min, max); // Total number of circles
 
-    // LevelType 'B' exclusive variables
+    // gameModeType 'B' exclusive variables
     this.fractionIndex = -1; // Index of clicked circle (game B)
     this.numberOfPlusFractions = game.math.randomInRange(1, total - 1);
 
     // CIRCLES
-    const levelDirection = (sublevelType == 'Minus') ? -1 : 1;
+    const levelDirection = (gameOperationType == 'Minus') ? -1 : 1;
     const x = startX + 65 * levelDirection;
 
     for (let i = 0; i < total; i++) {
@@ -130,7 +127,7 @@ const circleOne = {
       // Set each circle direction
       let direction;
 
-      switch (sublevelType) {
+      switch (gameOperationType) {
         case 'Plus': direction = 'Right'; break;
         case 'Minus': direction = 'Left'; break;
         case 'Mixed':
@@ -191,7 +188,7 @@ const circleOne = {
       circle.rotate = 90;
 
       // If game is type B (select fractions)
-      if (levelType == 'B') {
+      if (gameModeType == 'B') {
         circle.alpha = 0.5;
         circle.index = i;
       }
@@ -213,7 +210,7 @@ const circleOne = {
     }
 
     // If game is type B, selectiong a random balloon place
-    if (levelType == 'B') {
+    if (gameModeType == 'B') {
       this.balloonPlace = startX;
       this.endIndex = game.math.randomInRange(this.numberOfPlusFractions, this.circles.all.length);
 
@@ -233,7 +230,7 @@ const circleOne = {
 
     this.kid = game.add.sprite(startX, 495 - this.circles.all.length * this.circles.diameter, 'kid_walk', 0, 0.8);
     this.kid.anchor(0.5, 0.8);
-    if (sublevelType == 'Minus') {
+    if (gameOperationType == 'Minus') {
       this.kid.animation = this.availableAnimations['Left'];
       this.kid.curFrame = 23;
     } else {
@@ -395,16 +392,16 @@ const circleOne = {
     const x = mouseEvent.offsetX;
     const y = mouseEvent.offsetY;
 
-    // LEVEL A : click road
-    if (levelType == 'A') {
+    // GAME MODE A : click road
+    if (gameModeType == 'A') {
       const cur = self.road;
 
       const valid = y > 60 && (x >= cur.xWithAnchor && x <= (cur.xWithAnchor + cur.width * cur.scale));
       if (valid) self.func_clicked(x);
     }
 
-    // LEVEL B : click circle
-    if (levelType == 'B') {
+    // GAME MODE B : click circle
+    if (gameModeType == 'B') {
       self.circles.all.forEach(cur => {
         const valid = game.math.distanceToPointer(x, cur.xWithAnchor, y, cur.yWithAnchor) <= (cur.diameter / 2) * cur.scale;
         if (valid) self.func_clicked(cur);
@@ -426,8 +423,8 @@ const circleOne = {
     const y = mouseEvent.offsetY;
     let flag = false;
 
-    // LEVEL A : balloon follow mouse
-    if (levelType == 'A' && !self.hasClicked) {
+    // GAME MODE A : balloon follow mouse
+    if (gameModeType == 'A' && !self.hasClicked) {
       if (game.math.distanceToPointer(x, self.balloon.x, y, self.balloon.y) > 8) {
         self.balloon.x = x;
         self.basket.x = x;
@@ -436,8 +433,8 @@ const circleOne = {
       document.body.style.cursor = 'auto';
     }
 
-    // LEVEL B : hover circle
-    if (levelType == 'B' && !self.hasClicked) {
+    // GAME MODE B : hover circle
+    if (gameModeType == 'B' && !self.hasClicked) {
       self.circles.all.forEach(cur => {
         const valid = game.math.distanceToPointer(x, cur.xWithAnchor, y, cur.yWithAnchor) <= (cur.diameter / 2) * cur.scale;
         if (valid) {
@@ -456,7 +453,7 @@ const circleOne = {
   /* CALLED BY EVENT HANDLER */
 
   /**
-   * (in levelType 'B')
+   * (in gameModeType 'B')
    * 
    * Function called when cursor is over a valid circle
    * 
@@ -472,7 +469,7 @@ const circleOne = {
   },
 
   /**
-   * (in levelType 'B')
+   * (in gameModeType 'B')
    * 
    * Function called when cursor is out of a valid circle
    */
@@ -486,7 +483,7 @@ const circleOne = {
   },
 
   /**
-   * (in levelType 'B')
+   * (in gameModeType 'B')
    * 
    * Function called when player clicked over a valid circle
    * 
@@ -495,13 +492,13 @@ const circleOne = {
   func_clicked: function (cur) {
     if (!self.hasClicked) {
 
-      // On levelType A
-      if (levelType == 'A') {
+      // On gameModeType A
+      if (gameModeType == 'A') {
         self.balloon.x = cur;
         self.basket.x = cur;
-        // On levelType B
+        // On gameModeType B
       }
-      else if (levelType == 'B') {
+      else if (gameModeType == 'B') {
 
         document.body.style.cursor = 'auto';
 
@@ -561,11 +558,11 @@ const circleOne = {
    */
   func_viewHelp: function () {
     if (!self.hasClicked) {
-      // On levelType A
-      if (levelType == 'A') {
+      // On gameModeType A
+      if (gameModeType == 'A') {
         self.help.x = self.correctX;
         self.help.y = 490;
-        // On levelType B
+        // On gameModeType B
       } else {
         self.help.x = self.circles.all[self.endIndex - 1].x;
         self.help.y = self.circles.all[self.endIndex - 1].y - self.circles.diameter / 2;
@@ -585,8 +582,8 @@ const circleOne = {
   postScore: function () {
     // Creates string that is going to be sent to db
     const data = '&line_game=' + gameShape
-      + '&line_mode=' + levelType
-      + '&line_oper=' + sublevelType
+      + '&line_mode=' + gameModeType
+      + '&line_oper=' + gameOperationType
       + '&line_leve=' + gameDifficulty
       + '&line_posi=' + mapPosition
       + '&line_resu=' + self.result

+ 43 - 43
js/globals.js

@@ -6,12 +6,12 @@ LInE - Free Education, Private Data.
 .........../...........\....................|........ } game (gameType)
 ........One.............Two................One....... }
 ......./...\.........../...\............./....\...... 
-......A.....B.........A.....B...........A......B..... } level (levelType)
+......A.....B.........A.....B...........A......B..... } game mode (gameModeType)
 .(floor)..(stack)..(top)..(bottom)..(floor)..(stack). } 
 .......\./.............\./................\./........ 
 ........|...............|..................|......... 
 ......./.\..............|................/.|.\....... 
-...Plus...Minus.......Equals........Plus.Minus.Mixed. } sublevel (sublevelType)
+...Plus...Minus.......Equals........Plus.Minus.Mixed. } game math operation (gameOperationType)
 .......\./..............|................\.|./....... 
 ........|...............|..................|......... 
 ......1,2,3.........1,2,3,4,5..........1,2,3,4,5..... } difficulty (gameDifficulty)
@@ -37,6 +37,7 @@ let gameType;
  */
 let gameTypestring;
 /**
+ * Used for text and game information.<br>
  * Shape that makes the name of the game - e.g in 'squareOne' it is 'square'.<br>
  * Can be: 'circle' or 'square'.
  * 
@@ -44,24 +45,24 @@ let gameTypestring;
  */
 let gameShape;
 /**
- * Holds game level.<br>
+ * Holds selected game mode.<br>
  * In squareOne/circleOne   can be: 'A' (click on the floor) or 'B' (click on the amount to go/stacked figures).<br>
  * In squareTwo             can be: 'A' (more subdivisions on top) or 'B' (more subdivisions on bottom).
  * 
  * @type {string}
  */
-let levelType;
+let gameModeType;
 /**
- * Holds game operation.<br>
- * In squareOne     can be: 'Plus' or 'Minus'.<br>
- * In circleOne     can be: 'Plus', 'Minus' or 'Mixed'.<br>
- * In squareTwo     can be: 'Equals'.
+ * Holds game math operation.<br>
+ * In squareOne     can be: 'Plus' (green tractor goes right) or 'Minus' (red tractor goes left).<br>
+ * In circleOne     can be: 'Plus' (green tractor goes right), 'Minus' (red tractor goes left) or 'Mixed' (green tractor goes both sides).<br>
+ * In squareTwo     can be: 'Equals' (compares two rectangle subdivisions).
  * 
  * @type {string}
  */
-let sublevelType;
+let gameOperationType;
 /**
- * Holds game difficulty.<br> 
+ * Holds game overall difficulty. 1 (easier) -> n (harder).<br> 
  * In squareOne             can be: 1..3.<br>
  * In circleOne/squareTwo   can be: 1..5.
  * 
@@ -101,7 +102,7 @@ let langstring;
  */
 let self;
 /**
- * Character position on the map (1..4: valid; 5: end)
+ * Character position on the map, aka game levels (1..4: valid; 5: end)
  * @type {number}
  */
 let mapPosition;
@@ -126,9 +127,9 @@ const info = {
     gameShape: 'square',
     gameType: 'squareOne',
     gameTypeUrl: 'game0',
-    levelType: ['A', 'B'],
-    levelTypeUrl: ['level0', 'level1'],
-    sublevelType: ['Plus', 'Minus'],
+    gameModeType: ['A', 'B'],
+    gameModeTypeUrl: ['mode0', 'mode1'],
+    gameOperationType: ['Plus', 'Minus'],
     gameDifficulty: 3
   },
 
@@ -136,9 +137,9 @@ const info = {
     gameShape: 'circle',
     gameType: 'circleOne',
     gameTypeUrl: 'game1',
-    levelType: ['A', 'B'],
-    levelTypeUrl: ['level2', 'level3'],
-    sublevelType: ['Plus', 'Minus', 'Mixed'],
+    gameModeType: ['A', 'B'],
+    gameModeTypeUrl: ['mode2', 'mode3'],
+    gameOperationType: ['Plus', 'Minus', 'Mixed'],
     gameDifficulty: 5
   },
 
@@ -146,18 +147,18 @@ const info = {
     gameShape: 'square',
     gameType: 'squareTwo',
     gameTypeUrl: 'game2',
-    levelType: ['A', 'B'],
-    levelTypeUrl: ['level4', 'level5'],
-    sublevelType: ['Equals'],
+    gameModeType: ['A', 'B'],
+    gameModeTypeUrl: ['mode4', 'mode5'],
+    gameOperationType: ['Equals'],
     gameDifficulty: 5
   },
 
   gameShape: [],
   gameType: [],
   gameTypeUrl: [],
-  levelType: [],
-  levelTypeUrl: [],
-  sublevelType: [],
+  gameModeType: [],
+  gameModeTypeUrl: [],
+  gameOperationType: [],
   gameDifficulty: [],
 
   /**
@@ -183,11 +184,11 @@ const info = {
       info.squareTwo.gameTypeUrl
     ];
 
-    info.levelType = info.squareOne.levelType.concat(info.circleOne.levelType, info.squareTwo.levelType);
+    info.gameModeType = info.squareOne.gameModeType.concat(info.circleOne.gameModeType, info.squareTwo.gameModeType);
 
-    info.levelTypeUrl = info.squareOne.levelTypeUrl.concat(info.circleOne.levelTypeUrl, info.squareTwo.levelTypeUrl);
+    info.gameModeTypeUrl = info.squareOne.gameModeTypeUrl.concat(info.circleOne.gameModeTypeUrl, info.squareTwo.gameModeTypeUrl);
 
-    info.sublevelType = info.squareOne.sublevelType.concat(info.circleOne.sublevelType, info.squareTwo.sublevelType);
+    info.gameOperationType = info.squareOne.gameOperationType.concat(info.circleOne.gameOperationType, info.squareTwo.gameOperationType);
 
     info.gameDifficulty = [
       info.squareOne.gameDifficulty,
@@ -323,19 +324,18 @@ const url = {
       ['game2', medSrc + 'levels/squareTwo.png'], // Square II
     ],
     sprite: [
-      // level
-      ['level0', medSrc + 'levels/squareOne_1.png', 2], // Square I : A
-      ['level1', medSrc + 'levels/squareOne_2.png', 2], // Square I : B
-      ['level2', medSrc + 'levels/circleOne_1.png', 2], // Circle I : A
-      ['level3', medSrc + 'levels/circleOne_2.png', 2], // Circle I : B
-      ['level4', medSrc + 'levels/squareTwo_1.png', 2], // Square II : top
-      ['level5', medSrc + 'levels/squareTwo_2.png', 2], // Square II : bottom
-      // Sublevel
+      // Game modes
+      ['mode0', medSrc + 'levels/squareOne_1.png', 2], // Square I : A
+      ['mode1', medSrc + 'levels/squareOne_2.png', 2], // Square I : B
+      ['mode2', medSrc + 'levels/circleOne_1.png', 2], // Circle I : A
+      ['mode3', medSrc + 'levels/circleOne_2.png', 2], // Circle I : B
+      ['mode4', medSrc + 'levels/squareTwo_1.png', 2], // Square II : A
+      ['mode5', medSrc + 'levels/squareTwo_2.png', 2], // Square II : B
+      // Math operations
       ['operation_plus', medSrc + 'levels/operation_plus.png', 2], // Square/circle I : right
       ['operation_minus', medSrc + 'levels/operation_minus.png', 2], // Square/circle I : left
       ['operation_mixed', medSrc + 'levels/operation_mixed.png', 2], // Circle I : mixed 
       ['operation_equals', medSrc + 'levels/operation_equals.png', 2], // Square II : equals
-      
     ],
     audio: []
   },
@@ -397,11 +397,11 @@ const navigationIcons = {
    * @param {boolean} leftIcon2 3rd left icon
    * @param {boolean} rightIcon0 1st right icon
    * @param {boolean} rightIcon1 2nd right icon
-   * @param {string} level state to be called by the 'back' button
+   * @param {string} state state to be called by the 'back' button
    * @param {function} help function in the current game state that display correct answer
    */
-  func_addIcons: function (leftIcon0, leftIcon1, leftIcon2, rightIcon0, rightIcon1, level, help) {
-    this.level = level;
+  func_addIcons: function (leftIcon0, leftIcon1, leftIcon2, rightIcon0, rightIcon1, state, help) {
+    this.state = state;
     this.help = help;
 
     let left_x = 10;
@@ -472,7 +472,7 @@ const navigationIcons = {
       if (game.math.isOverIcon(x, y, cur)) {
         const name = cur.name;
         switch (name) {
-          case 'back': navigationIcons.func_CallState(navigationIcons.level); break;
+          case 'back': navigationIcons.func_CallState(navigationIcons.state); break;
           case 'menu': navigationIcons.func_CallState('menu'); break;
           case 'help': navigationIcons.help(); break;
           case 'language': navigationIcons.func_CallState('lang'); break;
@@ -507,11 +507,11 @@ const navigationIcons = {
       if (game.math.isOverIcon(x, y, cur)) {
         flag = true;
 
-        if (cur.name == 'back') navigationIcons.left_text.name = game.lang.menu_back;
-        else if (cur.name == 'menu') navigationIcons.left_text.name = game.lang.menu_list;
-        else if (cur.name == 'help') navigationIcons.left_text.name = game.lang.menu_help;
+        if (cur.name == 'back') navigationIcons.left_text.name = game.lang.nav_back;
+        else if (cur.name == 'menu') navigationIcons.left_text.name = game.lang.nav_menu;
+        else if (cur.name == 'help') navigationIcons.left_text.name = game.lang.nav_help;
 
-        else if (cur.name == 'language') navigationIcons.right_text.name = game.lang.menu_world;
+        else if (cur.name == 'language') navigationIcons.right_text.name = game.lang.nav_lang;
         else if (cur.name == 'audio') navigationIcons.right_text.name = game.lang.audio;
       }
     });

+ 6 - 6
js/map.js

@@ -1,5 +1,5 @@
 /**
- * MAP STATE: game map where character advances as he passes a level
+ * MAP STATE: game map with game levels - shows how many levels the player have finished / current level he is in
  * 
  * @namespace
  */
@@ -80,10 +80,10 @@ const mapState = {
 
       const aux = (i < mapPosition || (mapMove && i == mapPosition)) ? 'place_on' : 'place_off';
 
-      // Map road positions
+      // Map road positions - game levels
       game.add.image(this.points.x[i], this.points.y[i], aux, 0.3).anchor(0.5, 0.5);
 
-      // Level signs
+      // Map road signs - game level number
       game.add.image(this.points.x[i] - 20, this.points.y[i] - 60, 'sign', 0.4).anchor(0.5, 1);
       game.add.text(this.points.x[i] - 20, this.points.y[i] - 79, i, textStyles.h2_white);
 
@@ -92,7 +92,7 @@ const mapState = {
     // Game Character 
     if (gameTypeString == 'squareOne') {
 
-      if (sublevelType == 'Plus') {
+      if (gameOperationType == 'Plus') {
         this.character = game.add.sprite(this.points.x[mapPosition], this.points.y[mapPosition], 'tractor', 0, 0.5);
         this.character.animation = ['green_tractor', [0, 1, 2, 3, 4], 3];
       } else {
@@ -204,7 +204,7 @@ const mapState = {
 };
 
 /**
- * ENDING STATE: animation after a full level is completed
+ * ENDING STATE: animation after a full game is completed (4 levels)
  * 
  * @namespace
  */
@@ -285,7 +285,7 @@ const endState = {
         // Tractor
         this.character = game.add.sprite(0, 490, 'tractor', 0, 0.7);
         this.character.anchor(0.5, 0.5);
-        if (sublevelType == 'Plus') {
+        if (gameOperationType == 'Plus') {
           this.character.animation = ['move', [0, 1, 2, 3, 4], 4];
         } else {
           this.character.curFrame = 10;

+ 27 - 27
js/menu.js

@@ -161,8 +161,8 @@ const menuState = {
     let title;
 
     switch (icon.gameShape) {
-      case 'circle': title = game.lang.circle_name; break;
-      case 'square': title = game.lang.square_name; break;
+      case 'circle': title = game.lang.circle; break;
+      case 'square': title = game.lang.square; break;
     }
 
     const type = icon.gameType.substring(icon.gameType.length - 3);
@@ -186,7 +186,7 @@ const menuState = {
 };
 
 /**
- * SECUNDARY MENU STATE: player can select level, sublevel and difficulty
+ * SECUNDARY MENU STATE: player can select game mode, math operation and overall game difficulty
  * 
  * @namespace
  */
@@ -235,10 +235,10 @@ const customMenuState = {
     let offsetW = 600 / 6;
     let offsetH;
 
-    // Label 'Level - Mode'
-    game.add.text(x + offsetW - 12, y, game.lang.level, textStyles.h2_blue_2);
-    // Label 'Sublevel - Operation'
-    game.add.text(x + 3 * offsetW, y, game.lang.sublevel, textStyles.h2_blue_2);
+    // Label 'Game Mode'
+    game.add.text(x + offsetW - 12, y, game.lang.game_mode, textStyles.h2_blue_2);
+    // Label 'Operation'
+    game.add.text(x + 3 * offsetW, y, game.lang.operation, textStyles.h2_blue_2);
     // Label 'Difficulty'
     game.add.text(x + 5 * offsetW, y, game.lang.difficulty, textStyles.h2_blue_2);
     // Horizontal line
@@ -252,11 +252,11 @@ const customMenuState = {
       // Horizontal line
       game.add.graphic.rect(x + 4 * offsetW, y + 136, 200 + 25, width, undefined, 0, colors.blueMenuLine).anchor(0, 0.5);
 
-      // Label 'Show Fractions'
+      // Label 'Show Fractions / Auxiliar rectangles'
       game.add.text(x + 5 * offsetW, y + 102, game.lang.show, textStyles.h4_blue_2);
       
       if (gameTypeString == 'squareTwo') {
-        game.add.text(x + 5 * offsetW + 10, y + 102 + 24,  game.lang.box_guide, textStyles.h4_blue_2);
+        game.add.text(x + 5 * offsetW + 10, y + 102 + 24,  game.lang.aux_rectangle, textStyles.h4_blue_2);
       } else {
         game.add.text(x + 5 * offsetW, y + 102 + 24, game.lang.title, textStyles.h2_blue_2);
       }
@@ -270,31 +270,31 @@ const customMenuState = {
       selectionBox.iconType = 'selectionBox';
       this.menuIcons.push(selectionBox);
 
-    // --------------------------- LEVEL ICONS
+    // --------------------------- GAME MODE ICONS
 
     x = 150 + offsetW;
     y = baseY;
-    offsetH = this.func_getOffset(height, info[gameTypeString].levelType.length);
+    offsetH = this.func_getOffset(height, info[gameTypeString].gameModeType.length);
 
-    for (let i = 0; i < info[gameTypeString].levelTypeUrl.length; i++, y += offsetH) {
-      const icon = game.add.sprite(x, y, info[gameTypeString].levelTypeUrl[i], 0, iconScale, 1);
+    for (let i = 0; i < info[gameTypeString].gameModeTypeUrl.length; i++, y += offsetH) {
+      const icon = game.add.sprite(x, y, info[gameTypeString].gameModeTypeUrl[i], 0, iconScale, 1);
       icon.anchor(0.5, 0.5);
 
-      icon.levelType = info[gameTypeString].levelType[i];
-      icon.iconType = 'level';
+      icon.gameModeType = info[gameTypeString].gameModeType[i];
+      icon.iconType = 'gameMode';
       if (i == 0) {
-        levelType = icon.levelType;
+        gameModeType = icon.gameModeType;
         icon.curFrame = 1;
       }
 
       this.menuIcons.push(icon);
     }
 
-    // --------------------------- SUBLEVEL ICONS
+    // --------------------------- GAME OPERATION ICONS
 
     x += 2 * offsetW;
     y = baseY;
-    offsetH = this.func_getOffset(height, info[gameTypeString].sublevelType.length);
+    offsetH = this.func_getOffset(height, info[gameTypeString].gameOperationType.length);
 
     let icon;
     let aux = [];
@@ -311,16 +311,16 @@ const customMenuState = {
       ['operation_equals', 'Equals'],
     ];
 
-    // Placing sublevel icons
+    // Placing math operation icons
     for (let i = 0; i < aux[gameTypeString].length; i++, y += offsetH) {
       icon = game.add.sprite(x, y, aux[gameTypeString][i][0], 0, iconScale, 1);
       icon.anchor(0.5, 0.5);
 
-      icon.sublevelType = aux[gameTypeString][i][1];
-      icon.iconType = 'sublevel';
+      icon.gameOperationType = aux[gameTypeString][i][1];
+      icon.iconType = 'gameOperation';
 
       if (i == 0) {
-        sublevelType = icon.sublevelType;
+        gameOperationType = icon.gameOperationType;
         icon.curFrame = 1;
       }
 
@@ -385,8 +385,8 @@ const customMenuState = {
 
     const type = icon.iconType;
     switch (type) {
-      case 'level': levelType = icon.levelType; break;
-      case 'sublevel': sublevelType = icon.sublevelType; break;
+      case 'gameMode': gameModeType = icon.gameModeType; break;
+      case 'gameOperation': gameOperationType = icon.gameOperationType; break;
       case 'difficulty': gameDifficulty = icon.difficulty; break;
       case 'selectionBox':
         if (icon.curFrame == 0) {
@@ -399,7 +399,7 @@ const customMenuState = {
         game.render.all();
         break;
       case 'enter':
-        if (debugMode) console.log('Game State: ' + gameTypeString + ', ' + levelType);
+        if (debugMode) console.log('Game State: ' + gameTypeString + ', ' + gameModeType);
         mapPosition = 0;      // Map position
         mapMove = true;       // Move no next point
         completedLevels = 0;  // Reset the game progress when entering a new level
@@ -445,10 +445,10 @@ const customMenuState = {
       self.menuIcons.forEach(cur => {
         if (cur.iconType == self.menuIcons[overIcon].iconType) { // if its in the same icon category
           if (cur == self.menuIcons[overIcon]) { // if its the clicked icon
-            if (cur.iconType == 'level' || cur.iconType == 'sublevel') cur.curFrame = 1;
+            if (cur.iconType == 'gameMode' || cur.iconType == 'gameOperation') cur.curFrame = 1;
             else if (cur.iconType == 'difficulty') cur.fillColor = colors.blue;
           } else {
-            if (cur.iconType == 'level' || cur.iconType == 'sublevel') cur.curFrame = 0;
+            if (cur.iconType == 'gameMode' || cur.iconType == 'gameOperation') cur.curFrame = 0;
             else if (cur.iconType == 'difficulty') cur.fillColor = colors.gray;
           }
         }

+ 50 - 51
js/squareOne.js

@@ -1,9 +1,8 @@
 /**
  * LInE - Free Education, Private Data
+ * 
  * iFractions GAME STATE
  *
- * LEVELS - SQUARE I & II: tractor level
- *
  * Name of game state : squareOne 
  * Shape : square
  * Character : tractor
@@ -11,16 +10,16 @@
  * Concept : Player associates 'blocks carried by the tractor' and 'floor spaces to be filled by them'
  * Represent fractions as : blocks
  *
- * # of different difficulties for each level : 3
+ * # of different difficulties : 3
  *
- * Levels can be : 'A' or 'B' (in variable 'levelType')
+ * Game modes can be : 'A' or 'B' (in variable 'gameModeType')
  *
  *   A : Player can select # of 'floor blocks' (hole in the ground)
  *       Selects size of hole to be made in the ground (to fill with the blocks in front of the truck)
  *   B : Player can select # of 'stacked blocks' (in front of the truck)
  *       Selects number of blocks in front of the truck (to fill the hole on the ground)
  *
- * Sublevels can be : 'Plus' or 'Minus' (in variable 'sublevelType')
+ * Operations can be : 'Plus' or 'Minus' (in variable 'gameOperationType')
  *
  *   Plus : addition of fractions
  *     Represented by : tractor going to the right (floor positions 0..8
@@ -45,14 +44,14 @@ const squareOne = {
 
     this.divisorsList = '';     // Hold the divisors for each fraction on stacked blocks (created for postScore())
 
-    this.DIREC_LEVEL = (sublevelType == 'Minus') ? -1 : 1;    // Will be multiplied to values to easily change tractor direction when needed
+    this.DIREC_LEVEL = (gameOperationType == 'Minus') ? -1 : 1;    // Will be multiplied to values to easily change tractor direction when needed
     this.animationSpeed = 2 * this.DIREC_LEVEL;   // X distance in which the tractor moves in each iteration of the animation
 
     // GAME VARIABLES
     this.defaultBlockWidth = 80;   // Base block width
     this.defaultBlockHeight = 40;  // Base block height
 
-    this.startX = (sublevelType == 'Minus') ? 730 : 170; // Initial 'x' coordinate for the tractor and stacked blocks
+    this.startX = (gameOperationType == 'Minus') ? 730 : 170; // Initial 'x' coordinate for the tractor and stacked blocks
 
     // BACKGROUND
 
@@ -77,7 +76,7 @@ const squareOne = {
     // TRACTOR 
     this.tractor = game.add.sprite(this.startX, 445, 'tractor', 0, 0.8);
 
-    if (sublevelType == 'Plus') {
+    if (gameOperationType == 'Plus') {
       this.tractor.anchor(1, 0.5);
       this.tractor.animation = ['move', [0, 1, 2, 3, 4], 4];
     } else {
@@ -91,26 +90,26 @@ const squareOne = {
       blocks: [], // Group of 'stacked' block objects
       labels: [], // Group of fraction labels on the side of 'stacked' blocks
 
-      index: undefined, // (levelType 'B') index of 'stacked' block selected by player
+      index: undefined, // (gameModeType 'B') index of 'stacked' block selected by player
 
       // Control variables for animation
       curIndex: 0, // (needs to be 0)
       curBlockEnd: undefined,
 
       // Correct values
-      correctIndex: undefined, // (levelType 'B') index of the CORRECT 'stacked' block
+      correctIndex: undefined, // (gameModeType 'B') index of the CORRECT 'stacked' block
     };
 
     // FLOOR BLOCKS variables
     this.floor = {
       blocks: [], // Group of 'floor' block objects
-      index: undefined, // (levelType 'A') index of 'floor' block selected by player
+      index: undefined, // (gameModeType 'A') index of 'floor' block selected by player
 
       // Control variables for animation
       curIndex: -1, // (needs to be -1)
 
       // Correct values
-      correctIndex: undefined, // (levelType 'A') index of the CORRECT 'floor' block
+      correctIndex: undefined, // (gameModeType 'A') index of the CORRECT 'floor' block
       correctX: undefined,  // 'x' coordinate of CORRECT 'floor' block
       correctXA: undefined, // Temporary variable 
       correctXB: undefined, // Temporary variable
@@ -124,7 +123,7 @@ const squareOne = {
 
     // SELECTION ARROW
 
-    if (levelType == 'A') {
+    if (gameModeType == 'A') {
       this.arrow = game.add.image(this.startX + this.defaultBlockWidth * this.DIREC_LEVEL, 480, 'arrow_down');
       this.arrow.anchor(0.5, 0.5);
       this.arrow.alpha = 0.5;
@@ -168,8 +167,8 @@ const squareOne = {
       const restOfCurBlock = (self.defaultBlockWidth - stck.blocks[stck.curIndex].width) * self.DIREC_LEVEL;
 
       // Check if block falls
-      if ((sublevelType == 'Plus' && stck.blocks[0].x >= (stck.curBlockEnd + restOfCurBlock)) ||
-        (sublevelType == 'Minus' && stck.blocks[0].x <= (stck.curBlockEnd + restOfCurBlock))) {
+      if ((gameOperationType == 'Plus' && stck.blocks[0].x >= (stck.curBlockEnd + restOfCurBlock)) ||
+        (gameOperationType == 'Minus' && stck.blocks[0].x <= (stck.curBlockEnd + restOfCurBlock))) {
 
         let lowerBlock = true;
 
@@ -184,7 +183,7 @@ const squareOne = {
 
           // (A) last stacked block (fixed) doesnt fit selected gap AKA NOT ENOUGH FLOOR BLOCKS (DOESNT CHECK TOO MANY)
           // (B) selected stacked index doesnt fit last floor gap (fixed) AKA TOO MANY STACKED BLOCKS (DOESNT CHECK NOT ENOUGH)
-          if ((sublevelType == 'Plus' && curEnd > selectedEnd) || (sublevelType == 'Minus' && curEnd < selectedEnd)) {
+          if ((gameOperationType == 'Plus' && curEnd > selectedEnd) || (gameOperationType == 'Minus' && curEnd < selectedEnd)) {
             lowerBlock = false;
           }
         } else {
@@ -198,7 +197,7 @@ const squareOne = {
           // Until (B) last floor index (correct index - fixed)
           // Updates floor index to be equivalent to stacked index (and change alpha so floor appears to be filled)
           for (let i = 0; i <= floor.index; i++) {
-            if ((sublevelType == 'Plus' && floor.blocks[i].x < curEnd) || (sublevelType == 'Minus' && floor.blocks[i].x > curEnd)) {
+            if ((gameOperationType == 'Plus' && floor.blocks[i].x < curEnd) || (gameOperationType == 'Minus' && floor.blocks[i].x > curEnd)) {
               floor.blocks[i].alpha = 0.2;
               floor.curIndex = i;
             }
@@ -225,7 +224,7 @@ const squareOne = {
 
       game.animation.stop(self.tractor.animation[0]);
 
-      if (levelType == 'A') {
+      if (gameModeType == 'A') {
         self.result = self.floor.index == self.floor.correctIndex;
       } else {
         self.result = self.stck.index == self.stck.correctIndex;
@@ -239,7 +238,7 @@ const squareOne = {
         game.add.image(defaultWidth / 2, defaultHeight / 2, 'ok').anchor(0.5, 0.5);
         if (audioStatus) game.audio.okSound.play();
 
-        completedLevels++; // Increases number os passed levels
+        completedLevels++; // Increases number os finished levels
         if (debugMode) console.log('completedLevels = ' + completedLevels);
       } else { // Incorrect answer
         // Displays feedback image and sound
@@ -287,7 +286,7 @@ const squareOne = {
     const x = mouseEvent.offsetX;
     const y = mouseEvent.offsetY;
 
-    if (levelType == 'A') {
+    if (gameModeType == 'A') {
       self.floor.blocks.forEach(cur => {
         if (game.math.isOverIcon(x, y, cur)) self.func_clickSquare(cur);
       });
@@ -313,7 +312,7 @@ const squareOne = {
     let flagA = false;
     let flagB = false;
 
-    if (levelType == 'A') {
+    if (gameModeType == 'A') {
       // Make arrow follow mouse
       if (!self.hasClicked && !self.animateEnding) {
         if (game.math.distanceToPointer(self.arrow.x, x, self.arrow.y, y) > 8) {
@@ -331,7 +330,7 @@ const squareOne = {
       if (!flagA) self.func_outSquare('A');
     }
 
-    if (levelType == 'B') {
+    if (gameModeType == 'B') {
       self.stck.blocks.forEach(cur => {
         if (game.math.isOverIcon(x, y, cur)) {
           flagB = true;
@@ -359,8 +358,8 @@ const squareOne = {
     if (!self.hasClicked) {
       document.body.style.cursor = 'pointer';
 
-      // On leveltype A
-      if (levelType == 'A') {
+      // On gameModeType A
+      if (gameModeType == 'A') {
         for (let i in self.floor.blocks) {
           self.floor.blocks[i].alpha = (i <= cur.index) ? 1 : 0.5;
         }
@@ -368,7 +367,7 @@ const squareOne = {
         // Saves the index of the selected 'floor' block
         self.floor.index = cur.index;
 
-        // On leveltype B
+        // On gameModeType B
       } else {
         for (let i in self.stck.blocks) {
           self.stck.blocks[i].alpha = (i <= cur.index) ? 0.5 : 0.2;
@@ -387,14 +386,14 @@ const squareOne = {
     if (!self.hasClicked) {
       document.body.style.cursor = 'auto';
 
-      // On level type A
-      if (levelType == 'A') {
+      // On game mode A
+      if (gameModeType == 'A') {
         for (let i in self.floor.blocks) {
           self.floor.blocks[i].alpha = 0.5; // Back to normal
         }
 
         self.floor.index = -1;
-        // On level type B
+      // On game mode B
       } else {
         for (let i in self.stck.blocks) {
           self.stck.blocks[i].alpha = 0.5; // Back to normal
@@ -412,8 +411,8 @@ const squareOne = {
     if (!self.hasClicked && !self.animateEnding) {
       document.body.style.cursor = 'auto';
 
-      // On leveltype A
-      if (levelType == 'A') {
+      // On gameModeType A
+      if (gameModeType == 'A') {
         // Turns selection arrow completely visible
         self.arrow.alpha = 1;
 
@@ -425,7 +424,7 @@ const squareOne = {
 
         // (FIXED : self.STCK.index) save the 'stacked' blocks index
         self.stck.index = self.stck.blocks.length - 1;
-        // On leveltype B
+        // On gameModeType B
       } else {
         for (let i in self.stck.blocks) {
           // (FIXED : self.STCK.index)
@@ -468,7 +467,7 @@ const squareOne = {
    */
   func_createStckBlocks: function () {
     let hasBaseDifficulty = false; // Will be true after next for loop if level has at least one '1/difficulty' fraction (if false, restart)
-    const max = (levelType == 'B') ? 10 : mapPosition + 4; // Maximum number of stacked blocks for the level
+    const max = (gameModeType == 'B') ? 10 : mapPosition + 4; // Maximum number of stacked blocks for the level
 
     const total = game.math.randomInRange(mapPosition + 2, max); // Current number of stacked blocks for the level
 
@@ -485,7 +484,7 @@ const squareOne = {
       self.floor.correctXA += curBlockWidth * self.DIREC_LEVEL;
 
       // Create stacked block (close to tractor)
-      const lineColor = (sublevelType == 'Minus') ? colors.red : colors.darkBlue;
+      const lineColor = (gameOperationType == 'Minus') ? colors.red : colors.darkBlue;
       const lineSize = 2;
       const block = game.add.graphic.rect(
         self.startX,
@@ -496,11 +495,11 @@ const squareOne = {
         lineSize,
         colors.white,
         1);
-      const anchor = (sublevelType == 'Minus') ? 1 : 0;
+      const anchor = (gameOperationType == 'Minus') ? 1 : 0;
       block.anchor(anchor, 0);
 
       // If game is type B, adding events to stacked blocks
-      if (levelType == 'B') {
+      if (gameModeType == 'B') {
         block.alpha = 0.5;
         block.index = i;
       }
@@ -533,9 +532,9 @@ const squareOne = {
 
     // Check for errors (level too easy for its difficulty or end position out of bounds)
     if (!hasBaseDifficulty ||
-      (sublevelType == 'Plus' && (self.floor.correctXA < (self.startX + self.defaultBlockWidth) ||
+      (gameOperationType == 'Plus' && (self.floor.correctXA < (self.startX + self.defaultBlockWidth) ||
         self.floor.correctXA > (self.startX + 8 * self.defaultBlockWidth))) ||
-      (sublevelType == 'Minus' && (self.floor.correctXA < (self.startX - (8 * self.defaultBlockWidth)) ||
+      (gameOperationType == 'Minus' && (self.floor.correctXA < (self.startX - (8 * self.defaultBlockWidth)) ||
         self.floor.correctXA > (self.startX - self.defaultBlockWidth)))
     ) {
       restart = true; // If any error is found restart the level
@@ -557,7 +556,7 @@ const squareOne = {
     const blockWidth = self.defaultBlockWidth / divisor; // Width of each floor block
 
     // If game is type B, selectiong a random floor x position
-    if (levelType == 'B') {
+    if (gameModeType == 'B') {
       self.stck.correctIndex = game.math.randomInRange(0, (self.stck.blocks.length - 1)); // Correct stacked index
 
       self.floor.correctXB = self.startX + self.defaultBlockWidth * self.DIREC_LEVEL;
@@ -573,15 +572,15 @@ const squareOne = {
       // 'x' coordinate for floor block
       const x = self.startX + (self.defaultBlockWidth + i * blockWidth) * self.DIREC_LEVEL;
 
-      if (flag && levelType == 'A') {
-        if ((sublevelType == 'Plus' && x >= self.floor.correctXA) || (sublevelType == 'Minus' && x <= self.floor.correctXA)) {
+      if (flag && gameModeType == 'A') {
+        if ((gameOperationType == 'Plus' && x >= self.floor.correctXA) || (gameOperationType == 'Minus' && x <= self.floor.correctXA)) {
           self.floor.correctIndex = i - 1; // Set index of correct floor block
           flag = false;
         }
       }
 
-      if (levelType == 'B') {
-        if ((sublevelType == 'Plus' && x >= self.floor.correctXB) || (sublevelType == 'Minus' && x <= self.floor.correctXB)) {
+      if (gameModeType == 'B') {
+        if ((gameOperationType == 'Plus' && x >= self.floor.correctXB) || (gameOperationType == 'Minus' && x <= self.floor.correctXB)) {
           total = i;
           break;
         }
@@ -598,11 +597,11 @@ const squareOne = {
         lineSize,
         colors.blueBckgInsideLevel,
         1);
-      const anchor = (sublevelType == 'Minus') ? 1 : 0;
+      const anchor = (gameOperationType == 'Minus') ? 1 : 0;
       block.anchor(anchor, 0);
 
       // If game is type A, adding events to floor blocks
-      if (levelType == 'A') {
+      if (gameModeType == 'A') {
         block.alpha = 0.5;
         block.index = i;
       }
@@ -611,8 +610,8 @@ const squareOne = {
       self.floor.blocks.push(block);
     }
 
-    if (levelType == 'A') self.floor.correctX = self.floor.correctXA;
-    else if (levelType == 'B') self.floor.correctX = self.floor.correctXB;
+    if (gameModeType == 'A') self.floor.correctX = self.floor.correctXA;
+    else if (gameModeType == 'B') self.floor.correctX = self.floor.correctXB;
 
     // Creates labels on the floor to display the numbers
     for (let i = 1; i < 10; i++) {
@@ -626,12 +625,12 @@ const squareOne = {
    */
   func_viewHelp: function () {
     if (!self.hasClicked) {
-      // On levelType A
-      if (levelType == 'A') {
+      // On gameModeType A
+      if (gameModeType == 'A') {
         const aux = self.floor.blocks[0];
         self.help.x = self.floor.correctX - aux.width / 2 * self.DIREC_LEVEL;
         self.help.y = 501;
-        // On levelType B
+        // On gameModeType B
       } else {
         const aux = self.stck.blocks[self.stck.correctIndex];
         self.help.x = aux.x + aux.width / 2 * self.DIREC_LEVEL;
@@ -655,8 +654,8 @@ const squareOne = {
   postScore: function () {
     // Creates string that is going to be sent to db
     const data = '&line_game=' + gameShape
-      + '&line_mode=' + levelType
-      + '&line_oper=' + sublevelType
+      + '&line_mode=' + gameModeType
+      + '&line_oper=' + gameOperationType
       + '&line_leve=' + gameDifficulty
       + '&line_posi=' + mapPosition
       + '&line_resu=' + self.result

+ 6 - 9
js/squareTwo.js

@@ -1,10 +1,7 @@
 /**
- *
  * LInE - Free Education, Private Data
  *
  * iFractions GAME STATE
- * 
- * LEVELS - SQUARE III: fraction comparisson level
  *  
  * Name of game state : 'squareTwo' 
  * Shape : square
@@ -13,16 +10,16 @@
  * Concept : player select equivalent dividends for fractions with different divisors
  * Represent fractions as : subdivided blocks
  *
- * # of different difficulties for each level : 5
+ * # of different difficulties : 5
  *
- * Levels can be : 'A' or 'B' (in variable 'levelType')
+ * Game modes can be : 'A' or 'B' (in variable 'gameModeType')
  * 
  *   A : equivalence of fractions 
  *       top has more subdivisions
  *   B : equivalence of fractions
  *       bottom has more subdivisions
  * 
- * Sublevel : 'Equals' (in variable 'sublevelType')
+ * Operations : 'Equals' (in variable 'gameOperationType')
  *
  *   Equals : Player selects equivalent fractions of both blocks 
  * 
@@ -89,7 +86,7 @@ const squareTwo = {
 
     // Coordinates for A and B
     let xA, xB, yA, yB;
-    if (levelType != 'B') { // More subdivisions on B
+    if (gameModeType != 'B') { // More subdivisions on B
       xA = 230;
       yA = 90;
       xB = xA;
@@ -356,7 +353,7 @@ const squareTwo = {
       if (curBlock.index == self[curSet].blocks.length - 1) {
         const otherSet = (curSet == 'A') ? 'B' : 'A';
 
-        self[curSet].warningText.name = game.lang.error_msg;
+        self[curSet].warningText.name = game.lang.s2_error_msg;
         self[otherSet].warningText.name = '';
 
         self.func_outSquare(curSet);
@@ -453,7 +450,7 @@ const squareTwo = {
   postScore: function () {
     // Creates string that is going to be sent to db
     const data = '&line_game=' + gameShape
-      + '&line_mode=' + levelType
+      + '&line_mode=' + gameModeType
       + '&line_oper=Equal'
       + '&line_leve=' + gameDifficulty
       + '&line_posi=' + mapPosition

+ 3 - 3
php/README.md

@@ -54,7 +54,7 @@ You have to set values for the following variables in **/php/save.php** to match
 Inside **/js/globals.js** there's a global function called **sendToDB()**. When the player's information is collected after each game, the game file sends it as a parameter to **sendToDB()**. It makes an asynchronous call to **/php/save.php**, that executes the connection to the database.
 
 	const data = 'line_ip='// INSERT the IP of the machine where the MySQL was set up
-		+ '&line_name=' + //player's name
+		+ '&line_name=' + // player's name
 		+ '&line_lang=' + // selected language for the game
 		+ // data received from the game as parameter to this function
 
@@ -69,8 +69,8 @@ There is a function **postScore()** in every game file:
 After each level is completed (with the player's answer being correct or not), before going back to the level map, the function **postScore()**, is called. It joins all the player's progress information into a string (as can be seen below), that is sent as a parameter to **sendToDB()**, from **/js/globals.js**, that sends it to the database.
 
 	const data = '&line_game=' + // collect game shape
-	+ '&line_mode=' + // collect level type
-	+ '&line_oper=' + // collect sublevelType
+	+ '&line_mode=' + // collect game mode type
+	+ '&line_oper=' + // collect game math operation type
 	+ '&line_leve=' + // collect the selected difficulty for the game
 	+ '&line_posi=' + // collect the players position on the map
 	+ '&line_resu=' + // collect status for players answer (correct or incorrect)