Browse Source

In the process of changing the menu gui
- changed menu icons and text
- added guiding rectangles as an extra feature on squareTwo like "showFractions" is on square/circleOne
(on ifractions with phaser it was sublevelType "A". It was temporarily removed after removing phaser and it was now reinserted into the game)
- squareTwo metadata is standardized like square/circleOne (level/sublevel)
- removed shadow from menu icons
- updated language files

laira 3 years ago
parent
commit
194434e681
40 changed files with 183 additions and 206 deletions
  1. BIN
      assets/img/interac_icon/selectionBox.png
  2. BIN
      assets/img/levels/backup/circleOne_1.png
  3. BIN
      assets/img/levels/backup/circleOne_2.png
  4. BIN
      assets/img/levels/backup/levels_v1.psd
  5. BIN
      assets/img/levels/backup/levels_v2.psd
  6. BIN
      assets/img/levels/backup/squareOne_1.png
  7. BIN
      assets/img/levels/backup/squareOne_2.png
  8. BIN
      assets/img/levels/backup/squareTwo_3.png
  9. 0 0
      assets/img/levels/circleOne.png
  10. BIN
      assets/img/levels/circleOne_1.png
  11. BIN
      assets/img/levels/circleOne_2.png
  12. BIN
      assets/img/levels/operation_equals.png
  13. BIN
      assets/img/levels/operation_minus.png
  14. BIN
      assets/img/levels/operation_mixed.png
  15. BIN
      assets/img/levels/operation_plus.png
  16. 0 0
      assets/img/levels/squareOne.png
  17. BIN
      assets/img/levels/squareOne_1.png
  18. BIN
      assets/img/levels/squareOne_2.png
  19. BIN
      assets/img/levels/squareTwo_1.png
  20. BIN
      assets/img/levels/squareTwo_2.png
  21. BIN
      assets/img/levels/sublevel_bottom.png
  22. BIN
      assets/img/levels/sublevel_left.png
  23. BIN
      assets/img/levels/sublevel_mixed.png
  24. BIN
      assets/img/levels/sublevel_right.png
  25. BIN
      assets/img/levels/sublevel_top.png
  26. 5 4
      assets/lang/en_US
  27. 5 4
      assets/lang/es_PE
  28. 5 4
      assets/lang/fr_FR
  29. 4 3
      assets/lang/it_IT
  30. 5 4
      assets/lang/pt_BR
  31. 1 1
      index.html
  32. 10 10
      js/circleOne.js
  33. 11 1
      js/gameMechanics.js
  34. 35 42
      js/globals.js
  35. 0 0
      js/map.js
  36. 77 109
      js/menu.js
  37. 0 0
      js/preMenu.js
  38. 8 8
      js/squareOne.js
  39. 17 16
      js/squareTwo.js
  40. 0 0
      php/save.php

BIN
assets/img/interac_icon/selectionBox.png


BIN
assets/img/levels/backup/circleOne_1.png


BIN
assets/img/levels/backup/circleOne_2.png


BIN
assets/img/levels/backup/levels_v1.psd


BIN
assets/img/levels/backup/levels_v2.psd


BIN
assets/img/levels/backup/squareOne_1.png


BIN
assets/img/levels/backup/squareOne_2.png


BIN
assets/img/levels/backup/squareTwo_3.png


+ 0 - 0
assets/img/levels/circleOne.png


BIN
assets/img/levels/circleOne_1.png


BIN
assets/img/levels/circleOne_2.png


BIN
assets/img/levels/operation_equals.png


BIN
assets/img/levels/operation_minus.png


BIN
assets/img/levels/operation_mixed.png


BIN
assets/img/levels/operation_plus.png


+ 0 - 0
assets/img/levels/squareOne.png


BIN
assets/img/levels/squareOne_1.png


BIN
assets/img/levels/squareOne_2.png


BIN
assets/img/levels/squareTwo_1.png


BIN
assets/img/levels/squareTwo_2.png


BIN
assets/img/levels/sublevel_bottom.png


BIN
assets/img/levels/sublevel_left.png


BIN
assets/img/levels/sublevel_mixed.png


BIN
assets/img/levels/sublevel_right.png


BIN
assets/img/levels/sublevel_top.png


+ 5 - 4
assets/lang/en_US

@@ -1,26 +1,27 @@
 audio=AUDIO
+box_guide=Auxiliar Rectangles
 circle_name=Circles
 continue=Continue
 custom_game=CUSTOMIZE THE CURRENT GAME
-difficulty=Difficulty
+difficulty=Difficulties
 empty_name=You forgot to type your name
 error_msg=You should select a smaller portion than it's full size
+game=GAME
 game_menu_title=SELECT OPERATION AND DIFFICULTY
 good_job=Good Job
 insert_name=ENTER YOUR NAME
 label_name=labels
-level=Level
+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
-mode_name=MODE
 ready=READY
 retry=Try again
 show=Show
 square_name=Quadrangles
-sublevel=Sublevel
+sublevel=Operations
 title=Fractions
 welcome=Hi

+ 5 - 4
assets/lang/es_PE

@@ -1,26 +1,27 @@
 audio=AUDIO
+box_guide=Rectángulos Auxiliares
 circle_name=Circulos
 continue=Continúa
 custom_game=PERSONALIZAR EL JUEGO ACTUAL
-difficulty=Dificultad
+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
+game=JUEGO
 game_menu_title=SELECCIONA LA OPERACION Y DIFICULTAD
 good_job=Bien hecho
 insert_name=INGRESA TU NOMBRE
 label_name=etiquetas
-level=Nivel
+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
-mode_name=MODO
 ready=LISTO
 retry=Inténtalo de nuevo
 show=Mostrar
 square_name=Cuadrilateros
-sublevel=Subnivel
+sublevel=Operaciones
 title=Fracciones
 welcome=Hola

+ 5 - 4
assets/lang/fr_FR

@@ -1,26 +1,27 @@
 audio=AUDIO
+box_guide=Rectangles Auxiliaires
 circle_name=Cercles
 continue=Continuez
 custom_game=PERSONNALISER LE JEU ACTUEL
-difficulty=Difficulté
+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
+game=JEU
 game_menu_title=SÉLECTIONNEZ L'OPÉRATION ET LA DIFFICULTÉ
 good_job=Bon travail
 insert_name=ENTREZ VOTRE NOM
 label_name=étiquettes
-level=Niveau
+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
-mode_name=MODE
 ready=PRÊT
 retry=Réessayer
 show=Afficher les
 square_name=Quadrangles
-sublevel=Sous-niveau
+sublevel=Opérations
 title=Fractions
 welcome=Salut

+ 4 - 3
assets/lang/it_IT

@@ -1,26 +1,27 @@
 audio=AUDIO
+box_guide=Rettangoli Ausiliari
 circle_name=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
+game=GIOCO
 game_menu_title=SELEZIONARE UNA OPERAZIONE E UNA DIFFICOLTÁ
 good_job=Buon lavoro
 insert_name=SCRIVI IL TUO NOME
 label_name=legendas
-level=Livello
+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
-mode_name=MODO
 ready=OK
 retry=Tenta di nuovo
 show=Mostra le
 square_name=Quadrilateri
-sublevel=Sottolivello
+sublevel=Operazioni
 title=Frazioni
 welcome=Ciao

+ 5 - 4
assets/lang/pt_BR

@@ -1,26 +1,27 @@
 audio=ÁUDIO
+box_guide=Retângulos Auxiliares
 circle_name=Círculos
 continue=Continue
 custom_game=PERSONALIZE O JOGO ATUAL
-difficulty=Dificuldade
+difficulty=Dificuldades
 empty_name=Você esqueceu de digitar seu nome
 error_msg=Você deve selecionar uma porção menor que o seu tamanho total
+game=JOGO
 game_menu_title=SELECIONAR OPERAÇÃO E DIFICULDADE
 good_job=Bom trabalho
 insert_name=DIGITE SEU NOME
 label_name=legendas
-level=Nível
+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
-mode_name=MODO
 ready=PRONTO
 retry=Tente novamente
 show=Mostrar
 square_name=Quadriláteros
-sublevel=Subnível
+sublevel=Operações
 title=Frações
 welcome=Olá

+ 1 - 1
index.html

@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <!--
-LInE - Free Education, Private Data
+LInE - Free Education, Private Data.
 www.usp.br/line
 -->
 

+ 10 - 10
js/circleOne.js

@@ -17,19 +17,19 @@
  *
  * Levels can be : 'A' or 'B' (in variable 'levelType')
  *
- *     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)
+ *   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')
  *
- *     Plus : addition of fractions
- *         Represented by : kid going to the right (floor positions 0..5)
- *     Minus : subtraction of fractions
- *         Represented by: kid going to the left (floor positions 5..0)
- *     Mixed : Mix addition and subtraction of fractions in same
- *         Represented by: kid going to the left (floor positions 0..5)
+ *   Plus : addition of fractions
+ *     Represented by : kid going to the right (floor positions 0..5)
+ *   Minus : subtraction of fractions
+ *     Represented by: kid going to the left (floor positions 5..0)
+ *   Mixed : Mix addition and subtraction of fractions in same
+ *     Represented by: kid going to the left (floor positions 0..5)
  *
  * @namespace
  */

+ 11 - 1
js/gameMechanics.js

@@ -212,6 +212,7 @@ const game = {
           get xWithAnchor() { return this.x - (this.width * this.scale * this.xAnchor); },
           get yWithAnchor() { return this.y - (this.height * this.scale * this.yAnchor); }
         };
+        med.originalScale = med.scale;
         game.render.queue.push(med);
         return med;
       }
@@ -264,6 +265,7 @@ const game = {
           get xWithAnchor() { return this.x - (this.width * this.scale * this.xAnchor); },
           get yWithAnchor() { return this.y - (this.height * this.scale * this.yAnchor); }
         };
+        med.originalScale = med.scale;
         game.render.queue.push(med);
         return med;
       }
@@ -304,8 +306,13 @@ const game = {
           align: align || style.align || game.add._default.align,
 
           anchor: function () { console.error('Game error: there\'s no anchor for text'); },
+          set style (style) {
+            this.font = style.font;
+            this.fill = style.fill;
+            this.align = style.align;
+          },
           get xWithAnchor() { return this.x; },
-          get yWithAnchor() { return this.y; }
+          get yWithAnchor() { return this.y; },
         };
         game.render.queue.push(med);
         return med;
@@ -369,6 +376,7 @@ const game = {
             get xWithAnchor() { return this.x - (this.width * this.scale * this.xAnchor); },
             get yWithAnchor() { return this.y - (this.height * this.scale * this.yAnchor); }
           };
+          med.originalScale = med.scale;
           if (width != 0) { med.width = width || game.add._default.width; }
           if (height != 0) { med.height = height || width || game.add._default.height; }
           if (lineWidth != 0) { med.lineWidth = lineWidth || game.add._default.lineWidth; }
@@ -433,6 +441,7 @@ const game = {
             get xWithAnchor() { return this.x - (this.width * this.scale * this.xAnchor); },
             get yWithAnchor() { return this.y - (this.height * this.scale * this.yAnchor); }
           };
+          med.originalScale = med.scale;
           if (diameter != 0) {
             med.diameter = diameter || game.add._default.diameter;
             med.width = med.height = med.diameter;
@@ -505,6 +514,7 @@ const game = {
             get xWithAnchor() { return this.x - (this.width * this.scale * this.xAnchor); },
             get yWithAnchor() { return this.y - (this.height * this.scale * this.yAnchor); }
           };
+          med.originalScale = med.scale;
           if (diameter != 0) {
             med.diameter = diameter || game.add._default.diameter;
             med.width = med.height = med.diameter;

+ 35 - 42
js/globals.js

@@ -1,21 +1,21 @@
 /*
 LInE - Free Education, Private Data.
 
-.................................................... 
-.............square.................circle.......... }					} (gameShape)		 			 
-.........../........\.................|............. } game (gameType)
-........One..........Two.............One............ }
-......./...\..........|............./...\........... 
-......A.....B.........C............A.....B.......... } level (levelType)
-.(floor)..(stack)..(equal).....(floor).(stack)...... } 
-.......\./............|..............\./............ 
-........|.............|...............|............. 
-......./.\.........../.\............/.|.\........... 
-...Plus...Minus.....B...C.......Plus.Minus.Mixed.... } sublevel (sublevelType)
-.......\./...........\./............\.|./........... 
-........|.............|...............|............. 
-......1,2,3.......1,2,3,4,5.......1,2,3,4,5......... } difficulty (gameDifficulty)
-.................................................... 
+..................................................... 
+...............square....................circle...... }				        	} (gameShape)
+.........../...........\....................|........ } game (gameType)
+........One.............Two................One....... }
+......./...\.........../...\............./....\...... 
+......A.....B.........A.....B...........A......B..... } level (levelType)
+.(floor)..(stack)..(top)..(bottom)..(floor)..(stack). } 
+.......\./.............\./................\./........ 
+........|...............|..................|......... 
+......./.\..............|................/.|.\....... 
+...Plus...Minus.......Equals........Plus.Minus.Mixed. } sublevel (sublevelType)
+.......\./..............|................\.|./....... 
+........|...............|..................|......... 
+......1,2,3.........1,2,3,4,5..........1,2,3,4,5..... } difficulty (gameDifficulty)
+..................................................... 
 */
 
 const medSrc = 'assets/img/'; // Base directory for media
@@ -29,7 +29,6 @@ const defaultHeight = 600; // Default height for the Canvas
  * @type {object}
  */ 
 let gameType;
-
 /**
  * Name of the selected game.<br>
  * Can be: 'squareOne', 'squareTwo' or 'circleOne'.
@@ -37,7 +36,6 @@ let gameType;
  * @type {string}
  */
 let gameTypestring;
-
 /**
  * Shape that makes the name of the game - e.g in 'squareOne' it is 'square'.<br>
  * Can be: 'circle' or 'square'.
@@ -45,26 +43,23 @@ let gameTypestring;
  * @type {string}
  */
 let gameShape;
-
 /**
  * Holds game level.<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: 'C' (comparing fractions).
+ * In squareTwo             can be: 'A' (more subdivisions on top) or 'B' (more subdivisions on bottom).
  * 
  * @type {string}
  */
 let levelType;
-
 /**
  * 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: 'B' or 'C'
+ * In squareTwo     can be: 'Equals'.
  * 
  * @type {string}
  */
 let sublevelType;
-
 /**
  * Holds game difficulty.<br> 
  * In squareOne             can be: 1..3.<br>
@@ -73,9 +68,6 @@ let sublevelType;
  * @type {number}
  */
 let gameDifficulty;
-
-
-
 /**
  * Turns console messages ON/OFF (for debug purposes only)
  * @type {boolean}
@@ -91,8 +83,6 @@ let audioStatus = false;
  * @type {boolean}
  */
 let fractionLabel = true;
-
-
 /**
  * Player's name
  * @type {string}
@@ -156,9 +146,9 @@ const info = {
     gameShape: 'square',
     gameType: 'squareTwo',
     gameTypeUrl: 'game2',
-    levelType: ['C'],
-    levelTypeUrl: [],
-    sublevelType: [/*'A',*/ 'B', 'C'],
+    levelType: ['A', 'B'],
+    levelTypeUrl: ['level4', 'level5'],
+    sublevelType: ['Equals'],
     gameDifficulty: 5
   },
 
@@ -249,6 +239,7 @@ const textStyles = {
 
   h1_white: { font: '32px Arial,sans-serif', fill: colors.white, align: 'center' }, // Ok button (nameState)
   h2_white: { font: '26px Arial,sans-serif', fill: colors.white, align: 'center' }, // Difficulty buttons (menuState)
+  h3__white: { font: '23px Arial,sans-serif', fill: colors.white, align: 'center' }, // Difficulty numbers (menuState)
   h4_white: { font: '20px Arial,sans-serif', fill: colors.white, align: 'center' }, // Difficulty numbers (menuState)
   p_white: { font: '14px Arial,sans-serif', fill: colors.white, align: 'center' }, // Enter button (menuState)
 
@@ -330,20 +321,22 @@ const url = {
       ['game0', medSrc + 'levels/squareOne.png'], // Square I
       ['game1', medSrc + 'levels/circleOne.png'], // Circle I
       ['game2', medSrc + 'levels/squareTwo.png'], // Square II
-      // Level
-      ['level0', medSrc + 'levels/squareOne_1.png'], // Square I : A
-      ['level1', medSrc + 'levels/squareOne_2.png'], // Square I : B
-      ['level2', medSrc + 'levels/circleOne_1.png'], // Circle I : A
-      ['level3', medSrc + 'levels/circleOne_2.png'], // Circle I : B
-      ['level4', medSrc + 'levels/squareTwo.png'],  // Square II : C
+    ],
+    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
-      ['sublevel_right', medSrc + 'levels/sublevel_right.png'], // Square/circle I : right
-      ['sublevel_left', medSrc + 'levels/sublevel_left.png'], // Square/circle I : left
-      ['sublevel_mixed', medSrc + 'levels/sublevel_mixed.png'], // Circle I : mixed
-      ['sublevel_top', medSrc + 'levels/sublevel_top.png'], // Square II : top
-      ['sublevel_bottom', medSrc + 'levels/sublevel_bottom.png']  // Square II : bottom
+      ['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
+      
     ],
-    sprite: [],
     audio: []
   },
   squareOne: {

+ 0 - 0
js/map.js


+ 77 - 109
js/menu.js

@@ -12,6 +12,7 @@ const menuState = {
 
     // LOADING MEDIA
     game.load.image(url.menu.image);
+    game.load.sprite(url.menu.sprite);
 
   },
 
@@ -20,34 +21,26 @@ const menuState = {
    */
   create: function () {
 
-    // BACKGROUND
-
+    // Background color
     game.add.graphic.rect(0, 0, 900, 600, undefined, 0, colors.blueBckg, 1);
-
-    for (let i = 0; i < defaultWidth / 100; i++) {
-      game.add.image(i * 100, 501, 'floor');
-    }
-
-    // LABELS
+    // Floor
+    for (let i = 0; i < defaultWidth / 100; i++) { game.add.image(i * 100, 501, 'floor'); }
 
     // Overtitle: Welcome, <player name>!
     game.add.text(defaultWidth / 2, 40, game.lang.welcome + ', ' + playerName + '!', textStyles.h4_brown);
-
     // Title : Select a game
     game.add.text(defaultWidth / 2, 80, game.lang.menu_title, textStyles.h1_green);
-
     // Subtitle : <game mode> 
     this.lbl_game = game.add.text(defaultWidth / 2, 110, '', textStyles.h2_blue_2);
 
-    // NAVIGATION ICONS
-
     // Loads navigation icons
     navigationIcons.func_addIcons(
       false, false, false,
       true, true,
       false, false);
 
-    // -------------------- GAME ICONS 
+    // --------------------------- GAME ICONS 
+
     this.menuIcons = [];
 
     const offset = defaultWidth / (info.gameType.length + 1);
@@ -64,7 +57,7 @@ const menuState = {
 
     }
 
-    // EVENTS
+    // ------------- EVENTS
 
     game.event.add('click', this.func_onInputDown);
     game.event.add('mousemove', this.func_onInputOver);
@@ -215,174 +208,151 @@ const customMenuState = {
    */
   create: function () {
 
-    let x, y, width, height, offsetH, offsetW;
-    const iconScale = 0.5;
+    const iconScale = 0.7;
+    const baseY = 270 - 40;
+    this.menuIcons = [];
 
     // Background color
     game.add.graphic.rect(0, 0, 900, 600, undefined, 0, colors.blueBckg, 1);
-
     // Floor
     for (let i = 0; i < defaultWidth / 100; i++) { game.add.image(i * 100, 501, 'floor'); }
 
-    // LABELS
-
-    // Add Title : Select a game
+    // Overtitle : Selected game
+    game.add.text(defaultWidth / 2, 40, game.lang.game + ": " + menuState.menuIcons, textStyles.h4_brown);
+    // Title : Customize the selected game
     game.add.text(defaultWidth / 2, 80, game.lang.custom_game, textStyles.h1_green);
 
-    // Selected game
-    game.add.text(defaultWidth / 2, 40, menuState.menuIcons, textStyles.h4_brown);
-
-    // Loads animation icons
+    // Loads navigation icons
     navigationIcons.func_addIcons(
       true, false, false,
       true, true,
       'menu', false);
 
-
-    this.menuIcons = [];
-
-    offsetW = 600 / 6;
-    x = 150;
-    y = 200;
-    height = 280;
-    width = 5;
-
-    // Label 'Level'
-    game.add.text(x + offsetW, y, game.lang.level, textStyles.h2_blue_2);
-    // Label 'Sublevel'
-    const sublevelLabel = game.add.text(x + 3 * offsetW, y, game.lang.sublevel, textStyles.h2_blue_2);
+    let x = 150;
+    let y = 200 - 40;
+    let width = 5;
+    let height = 280 + 80;
+    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 'Difficulty'
     game.add.text(x + 5 * offsetW, y, game.lang.difficulty, textStyles.h2_blue_2);
-
     // Horizontal line
-    game.add.graphic.rect(x, y + 10, 600, width, undefined, 0, colors.blueMenuLine).anchor(0, 0.5);
-
-    // Vertical line
+    game.add.graphic.rect(x - 25, y + 10, 600 + 50, width, undefined, 0, colors.blueMenuLine).anchor(0, 0.5);
+    // Vertical lines
     game.add.graphic.rect(x + 2 * offsetW, y - 25, width, height, undefined, 0, colors.blueMenuLine).anchor(0.5, 0);
     game.add.graphic.rect(x + 4 * offsetW, y - 25, width, height, undefined, 0, colors.blueMenuLine).anchor(0.5, 0);
 
-    // --------------------------- TURN ON/OFF FRACTION LABELS
-
-    if (gameTypeString == 'squareTwo') {
-
-      sublevelLabel.alpha = 0.3;
-
-    } else {
+    // --------------------------- TURN ON/OFF FRACTION LABELS / RECTANGLE GUIDE
 
       // Horizontal line
-      game.add.graphic.rect(x + 4 * offsetW, y + 136, 200, width, undefined, 0, colors.blueMenuLine).anchor(0, 0.5);
+      game.add.graphic.rect(x + 4 * offsetW, y + 136, 200 + 25, width, undefined, 0, colors.blueMenuLine).anchor(0, 0.5);
 
       // Label 'Show Fractions'
       game.add.text(x + 5 * offsetW, y + 102, game.lang.show, textStyles.h4_blue_2);
-      game.add.text(x + 5 * offsetW, y + 102 + 24, game.lang.title, textStyles.h2_blue_2);
-
-      const frame = (fractionLabel) ? 1 : 0;
-
+      
+      if (gameTypeString == 'squareTwo') {
+        game.add.text(x + 5 * offsetW + 10, y + 102 + 24,  game.lang.box_guide, textStyles.h4_blue_2);
+      } else {
+        game.add.text(x + 5 * offsetW, y + 102 + 24, game.lang.title, textStyles.h2_blue_2);
+      }
+      
       // Selection box
       y += 40;
-      const selectionBox = game.add.sprite(x + 5 * offsetW, y + 102 + 24 - 2, 'select', frame, 0.1);
+      const frame = (fractionLabel) ? 1 : 0;
+
+      const selectionBox = game.add.sprite(x + 5 * offsetW, y + 102 + 24 - 2, 'select', frame, 0.11);
       selectionBox.anchor(0.5, 0.5);
       selectionBox.iconType = 'selectionBox';
-      selectionBox.originalScale = 0.1;
       this.menuIcons.push(selectionBox);
-    }
-
-    // ---------------------------- LEVEL ICONS
 
-    offsetH = this.func_getOffset(height, info[gameTypeString].levelType.length);
+    // --------------------------- LEVEL ICONS
 
     x = 150 + offsetW;
-    y = 270;
+    y = baseY;
+    offsetH = this.func_getOffset(height, info[gameTypeString].levelType.length);
 
     for (let i = 0; i < info[gameTypeString].levelTypeUrl.length; i++, y += offsetH) {
-
-      const icon = game.add.image(x, y, info[gameTypeString].levelTypeUrl[i], iconScale, 1);
+      const icon = game.add.sprite(x, y, info[gameTypeString].levelTypeUrl[i], 0, iconScale, 1);
       icon.anchor(0.5, 0.5);
 
       icon.levelType = info[gameTypeString].levelType[i];
       icon.iconType = 'level';
-      icon.originalScale = iconScale;
       if (i == 0) {
         levelType = icon.levelType;
-        icon.shadow = true;
+        icon.curFrame = 1;
       }
 
       this.menuIcons.push(icon);
-
     }
 
-    // ---------------------------- SUBLEVEL ICONS
+    // --------------------------- SUBLEVEL ICONS
 
+    x += 2 * offsetW;
+    y = baseY;
     offsetH = this.func_getOffset(height, info[gameTypeString].sublevelType.length);
 
-    if (gameTypeString != 'squareTwo') x += 2 * offsetW;
-    y = 270;
-
     let icon;
     let aux = [];
     aux['squareOne'] = [
-      ['sublevel_right', 'Plus'],
-      ['sublevel_left', 'Minus']
+      ['operation_plus', 'Plus'],
+      ['operation_minus', 'Minus']
     ];
     aux['circleOne'] = [
-      ['sublevel_right', 'Plus'],
-      ['sublevel_left', 'Minus'],
-      ['sublevel_mixed', 'Mixed']
+      ['operation_plus', 'Plus'],
+      ['operation_minus', 'Minus'],
+      ['operation_mixed', 'Mixed']
     ];
     aux['squareTwo'] = [
-      // ['sublevel_top', 'A'],
-      ['sublevel_bottom', 'B'],
-      ['sublevel_top', 'C'],
+      ['operation_equals', 'Equals'],
     ];
+
     // Placing sublevel icons
     for (let i = 0; i < aux[gameTypeString].length; i++, y += offsetH) {
-
-      icon = game.add.image(x, y, aux[gameTypeString][i][0], iconScale);
+      icon = game.add.sprite(x, y, aux[gameTypeString][i][0], 0, iconScale, 1);
       icon.anchor(0.5, 0.5);
-      icon.alpha = 1;
 
       icon.sublevelType = aux[gameTypeString][i][1];
       icon.iconType = 'sublevel';
-      icon.originalScale = iconScale;
 
       if (i == 0) {
         sublevelType = icon.sublevelType;
-        icon.shadow = true;
+        icon.curFrame = 1;
       }
 
       this.menuIcons.push(icon);
-
     }
 
     // --------------------------- DIFFICULTY ICONS
 
-    x = (gameTypeString == 'squareOne') ? 600 : 570;
-    y = 235;
+    x = (gameTypeString == 'squareOne') ? 625 : 585;
+    y = baseY - 25;
 
     for (let i = 0; i < info[gameTypeString].gameDifficulty; i++) {
-
       // Parameters
       const curX = x + (30 + 10) * i;
 
       // Difficulty menuIcons
-      const icon = game.add.graphic.rect(curX, y, 30, 30, undefined, 0, colors.green, 1);
+      const icon = game.add.graphic.rect(curX, y, 30, 30, undefined, 0, colors.gray, 1);
       icon.anchor(0.5, 0.5);
       icon.difficulty = i + 1;
       icon.iconType = 'difficulty';
-      icon.originalScale = 1;
 
       if (i == 0) {
         gameDifficulty = icon.difficulty;
-        icon.shadow = true;
+        icon.fillColor = colors.blue;
       }
       this.menuIcons.push(icon);
 
       // Difficulty numbers
       game.add.text(curX, y + 7, i + 1, textStyles.h4_white);
-
     }
 
-    // -------------- ENTER ICON
+    // --------------------------- ENTER ICON
 
     x = defaultWidth - 100;
     y = defaultHeight - 110;
@@ -390,13 +360,12 @@ const customMenuState = {
     const enterIcon = game.add.image(x, y, 'bush');
     enterIcon.anchor(0.5, 0.5);
     enterIcon.iconType = 'enter';
-    enterIcon.originalScale = 0.9;
 
     this.menuIcons.push(enterIcon);
 
-    game.add.text(x, y, game.lang.continue.toUpperCase(), textStyles.p_white);
+    this.enterText = game.add.text(x, y, game.lang.continue, textStyles.h4_white);
 
-    // EVENTS
+    // ------------- EVENTS
 
     game.event.add('click', this.func_onInputDown);
     game.event.add('mousemove', this.func_onInputOver);
@@ -471,16 +440,16 @@ const customMenuState = {
     }
 
     // Update gui
-    if (overIcon) {
-
+    if (overIcon) { // if has clicked on an icon
       document.body.style.cursor = 'pointer';
-
       self.menuIcons.forEach(cur => {
-        if (cur.iconType == self.menuIcons[overIcon].iconType) {
-          if (cur == self.menuIcons[overIcon]) {
-            cur.shadow = true;
+        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;
+            else if (cur.iconType == 'difficulty') cur.fillColor = colors.blue;
           } else {
-            cur.shadow = false;
+            if (cur.iconType == 'level' || cur.iconType == 'sublevel') cur.curFrame = 0;
+            else if (cur.iconType == 'difficulty') cur.fillColor = colors.gray;
           }
         }
       });
@@ -513,22 +482,21 @@ const customMenuState = {
     }
 
     // Update gui
-    if (overIcon) {
+    if (overIcon) { // if pointer is over icon
       document.body.style.cursor = 'pointer';
-
       self.menuIcons.forEach(cur => {
-        if (cur.iconType == self.menuIcons[overIcon].iconType) {
-          if (cur == self.menuIcons[overIcon]) {
+        if (cur.iconType == self.menuIcons[overIcon].iconType) { // if its in the same icon category
+          if (cur == self.menuIcons[overIcon]) { // if its the icon the pointer is over 
+            if (cur.iconType == 'enter') self.enterText.style = textStyles.h3__white;
             cur.scale = cur.originalScale * 1.1;
           } else {
             cur.scale = cur.originalScale;
           }
         }
       });
-    } else {
-      self.menuIcons.forEach(cur => {
-        cur.scale = cur.originalScale;
-      });
+    } else { // if pointer is not over icon
+      self.enterText.style = textStyles.h4_white;
+      self.menuIcons.forEach(cur => { cur.scale = cur.originalScale; });
       document.body.style.cursor = 'auto';
     }
 

+ 0 - 0
js/preMenu.js


+ 8 - 8
js/squareOne.js

@@ -15,17 +15,17 @@
  *
  * Levels can be : 'A' or 'B' (in variable 'levelType')
  *
- *     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)
+ *   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')
  *
- *     Plus : addition of fractions
- *         Represented by : tractor going to the right (floor positions 0..8
- *     Minus : subtraction of fractions
- *         Represented by: tractor going to the left (floor positions 8..0)
+ *   Plus : addition of fractions
+ *     Represented by : tractor going to the right (floor positions 0..8
+ *   Minus : subtraction of fractions
+ *     Represented by: tractor going to the left (floor positions 8..0)
  *
  * @namespace
  */

+ 17 - 16
js/squareTwo.js

@@ -15,16 +15,16 @@
  *
  * # of different difficulties for each level : 5
  *
- * Level : 'C' (in variable 'levelType')
- *
- *     C : Player selects equivalent fractions of both blocks 
+ * Levels can be : 'A' or 'B' (in variable 'levelType')
  * 
- * Sublevels can be : 'B' or 'C' (in variable 'sublevelType')
+ *   A : equivalence of fractions 
+ *       top has more subdivisions
+ *   B : equivalence of fractions
+ *       bottom has more subdivisions
  * 
- *     B : equivalence of fractions 
- *         top has more subdivisions
- *     C : equivalence of fractions
- *         bottom has more subdivisions
+ * Sublevel : 'Equals' (in variable 'sublevelType')
+ *
+ *   Equals : Player selects equivalent fractions of both blocks 
  * 
  * @namespace
  */
@@ -89,7 +89,7 @@ const squareTwo = {
 
     // Coordinates for A and B
     let xA, xB, yA, yB;
-    if (sublevelType != 'C') { // More subdivisions on B
+    if (levelType != 'B') { // More subdivisions on B
       xA = 230;
       yA = 90;
       xB = xA;
@@ -120,9 +120,9 @@ const squareTwo = {
 
     // CREATING TOP FIGURE (A)
     let blockWidth = this.figureWidth / totalBlocksA; // Width of each block in A
-    let lineColor = colors.darkGreen;
-    let fillColor = colors.lightGreen;
-
+    let lineColor = colors.darkRed;
+    let fillColor = colors.lightRed;
+    
     // Create blocks
     for (let i = 0; i < totalBlocksA; i++) {
       const x = xA + i * blockWidth;
@@ -135,7 +135,8 @@ const squareTwo = {
       this.A.blocks.push(block);
 
       // Auxiliar blocks
-      const alpha = (sublevelType == 'A') ? 0.2 : 0;
+      const alpha = (fractionLabel) ? 0.1 : 0;
+
       const yAux = yA + figureHeight + 10; // On the bottom of A
       const auxBlock = game.add.graphic.rect(x, yAux, blockWidth, figureHeight, lineColor, 1, fillColor, alpha);
       this.A.auxBlocks.push(auxBlock);
@@ -159,8 +160,8 @@ const squareTwo = {
 
     // CREATING BOTTOM FIGURE (B)
     blockWidth = this.figureWidth / totalBlocksB; // Width of each block in B
-    lineColor = colors.darkRed;
-    fillColor = colors.lightRed;
+    lineColor = colors.darkGreen;
+    fillColor = colors.lightGreen;
 
     // Blocks and auxiliar blocks
     for (let i = 0; i < totalBlocksB; i++) {
@@ -174,7 +175,7 @@ const squareTwo = {
       this.B.blocks.push(block);
 
       // Auxiliar blocks
-      const alpha = (sublevelType == 'A') ? 0.1 : 0;
+      const alpha = (fractionLabel) ? 0.1 : 0;
       const yAux = yB + figureHeight + 10; // On the bottom of B
       const auxBlock = game.add.graphic.rect(x, yAux, blockWidth, figureHeight, lineColor, 1, fillColor, alpha);
       this.B.auxBlocks.push(auxBlock);

+ 0 - 0
php/save.php