Просмотр исходного кода

fix bug in navigation icon that show correct anser

lairaalmas 1 год назад
Родитель
Сommit
d7c43c042b
3 измененных файлов с 23 добавлено и 27 удалено
  1. 20 24
      src/js/games/circleOne.js
  2. 1 1
      src/js/globals/globals_debug.js
  3. 2 2
      src/js/globals/globals_functions.js

+ 20 - 24
src/js/games/circleOne.js

@@ -150,9 +150,7 @@ const circleOne = {
     this.utils.renderCharacters(validPath);
 
     // Help pointer
-    this.help = game.add.image(0, 0, 'pointer', 0.5);
-    this.help.anchor(0.5, 0);
-    this.help.alpha = 0;
+    this.help = game.add.image(0, 0, 'pointer', 2, 0);
 
     // Text
     this.introText = [];
@@ -342,7 +340,7 @@ const circleOne = {
               y,
               circle.yWithAnchor
             ) <=
-            (cur.diameter / 2) * circle.scale;
+            (circle.diameter / 2) * circle.scale;
           if (valid) self.utils.clickHandler(circle);
         });
       }
@@ -846,6 +844,24 @@ const circleOne = {
       self.continueButton.alpha = 1;
     },
 
+    /**
+     * Show correct answer
+     */
+    showAnswer: function () {
+      if (!self.control.hasClicked) {
+        // On gameMode (a)
+        if (gameMode == 'a') {
+          self.help.x = self.control.correctX - 20;
+          self.help.y = self.road.y;
+          // On gameMode (b)
+        } else {
+          self.help.x = self.circles.list[self.control.endIndex - 1].x;
+          self.help.y = self.circles.list[self.control.endIndex - 1].y; // -            self.circles.diameter / 2;
+        }
+        self.help.alpha = 0.7;
+      }
+    },
+
     /**
      * (in gameMode 'b') Function called when player clicked over a valid circle
      *
@@ -944,26 +960,6 @@ const circleOne = {
       else return true;
     },
 
-    /**
-     * Show correct answer
-     */
-    showAnswer: function () {
-      if (!self.control.hasClicked) {
-        // On gameMode (a)
-        if (gameMode == 'a') {
-          self.help.x = self.control.correctX;
-          self.help.y = 490;
-          // On gameMode (b)
-        } else {
-          self.help.x = self.circles.list[self.control.endIndex - 1].x;
-          self.help.y =
-            self.circles.list[self.control.endIndex - 1].y -
-            self.circles.diameter / 2;
-        }
-        self.help.alpha = 0.7;
-      }
-    },
-
     endLevel: function () {
       game.state.start('map');
     },

+ 1 - 1
src/js/globals/globals_debug.js

@@ -7,7 +7,7 @@ const debugState = {
   customMenu: {
     status: true,
     getData: () => {
-      return { mode: 'a', operation: 'plus', difficulty: 1, label: true };
+      return { mode: 'b', operation: 'mixed', difficulty: 5, label: true };
     },
   },
   map: { status: true },

+ 2 - 2
src/js/globals/globals_functions.js

@@ -120,7 +120,7 @@ const navigationIcons = {
           case 'menu':
             navigationIcons.callState('menu');
             break;
-          case 'help':
+          case 'show_solution':
             navigationIcons.help();
             break;
           case 'language':
@@ -164,7 +164,7 @@ const navigationIcons = {
           case 'menu':
             navigationIcons.left_text.name = game.lang.nav_menu;
             break;
-          case 'help':
+          case 'show_solution':
             navigationIcons.left_text.name = game.lang.nav_help;
             break;
           case 'language':