Procházet zdrojové kódy

disable nav icon that show correct answer after use and after player action inside level

lairaalmas před 1 rokem
rodič
revize
4cb5e18b16

+ 3 - 2
src/js/games/circleOne.js

@@ -221,7 +221,6 @@ const circleOne = {
     },
     renderWalkedPath: function (x, y, color) {
       const path = game.add.geom.rect(x, y, 1, 1, color, 4);
-      //path.alpha = 0;
       self.walkedPath.push(path);
       return path;
     },
@@ -909,7 +908,7 @@ const circleOne = {
           self.ui.help.x = self.circles.list[self.control.correctIndex - 1].x;
           self.ui.help.y = self.circles.list[self.control.correctIndex - 1].y; // -            self.circles.diameter / 2;
         }
-        self.ui.help.alpha = 0.7;
+        self.ui.help.alpha = 1;
       }
     },
 
@@ -959,6 +958,8 @@ const circleOne = {
         self.ui.message[0].alpha = 0;
         self.ui.message[1].alpha = 0;
 
+        navigation.disableIcon(navigation.showAnswerIcon);
+
         self.balloon.alpha = 1;
         self.basket.alpha = 1;
         self.walkedPath[self.control.curWalkedPath].alpha = 1;

+ 3 - 0
src/js/games/squareOne.js

@@ -843,6 +843,9 @@ const squareOne = {
         // Play beep sound
         if (audioStatus) game.audio.popSound.play();
 
+        // Disable show answer nav icon
+        navigation.disableIcon(navigation.showAnswerIcon);
+        // Hide intro message
         self.ui.message[0].alpha = 0;
         self.ui.message[1].alpha = 0;
         // Hide labels

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

@@ -3,11 +3,11 @@ const isDebugMode = true;
 const debugState = {
   lang: { skip: true, lang: 'pt_BR' },
   name: { skip: true, name: 'Username' },
-  menu: { skip: true, id: 1 },
+  menu: { skip: true, id: 0 },
   customMenu: {
     skip: true,
     getData: () => {
-      return { mode: 'b', operation: 'mixed', difficulty: 5, label: true };
+      return { mode: 'b', operation: 'plus', difficulty: 3, label: true };
     },
   },
   map: { skip: true },

+ 15 - 7
src/js/globals/globals_functions.js

@@ -2,6 +2,7 @@ const navigation = {
   list: [],
   prevState: undefined,
   audioIcon: undefined,
+  showAnswerIcon: undefined,
   labelLeft: undefined,
   labelRight: undefined,
 
@@ -30,6 +31,7 @@ const navigation = {
           return;
         }
         const asset = game.add.image(x, 10, icon, 1.5);
+        navigation.showAnswerIcon = asset;
         navigation.list.push(asset);
         x += iconSize;
       });
@@ -48,9 +50,7 @@ const navigation = {
           navigation.audioIcon = asset;
         }
 
-        if (icon === 'lang') {
-          asset = game.add.image(x, 10, 'lang', 1.5);
-        }
+        if (icon === 'lang') asset = game.add.image(x, 10, 'lang', 1.5);
 
         navigation.list.push(asset);
         x -= iconSize;
@@ -65,9 +65,14 @@ const navigation = {
     game.state.start(state);
   },
 
+  disableIcon: (icon) => {
+    icon.alpha = 0.4;
+    icon.isDisabled = true;
+  },
+
   onInputDown: (x, y) => {
     navigation.list.forEach((icon) => {
-      if (game.math.isOverIcon(x, y, icon)) {
+      if (game.math.isOverIcon(x, y, icon) && !icon.isDisabled) {
         const iconName = icon.name;
         switch (iconName) {
           case 'menu':
@@ -81,8 +86,11 @@ const navigation = {
             navigation.changeState(state);
             break;
           case 'show_answer':
-            if (audioStatus) game.audio.popSound.play();
-            self.utils.showAnswer();
+            if (navigation.showAnswerIcon.alpha === 1) {
+              if (audioStatus) game.audio.popSound.play();
+              self.utils.showAnswer();
+              navigation.disableIcon(navigation.showAnswerIcon);
+            }
             break;
           case 'audio':
             if (audioStatus) {
@@ -105,7 +113,7 @@ const navigation = {
   onInputOver: (x, y) => {
     let isOverIcon = false;
     navigation.list.forEach((icon) => {
-      if (game.math.isOverIcon(x, y, icon)) {
+      if (game.math.isOverIcon(x, y, icon) && !icon.isDisabled) {
         isOverIcon = true;
         const iconName = icon.name;
         switch (iconName) {