Parcourir la source

feature: c1 - adjust road blocks logic to behave like plus when game mode is mixed

lairaalmas il y a 9 mois
Parent
commit
297ddb9093
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7 3
      js/games/circleOne.js

+ 7 - 3
js/games/circleOne.js

@@ -1345,7 +1345,8 @@ const circleOne = {
     /** TODO */
     isOverBlock: function (x, blockX, blockWidth) {
       if (
-        (gameOperation === 'plus' && x >= blockX && x < blockX + blockWidth) ||
+        gameOperation === 'plus' ||
+        (gameOperation === 'mixed' && x >= blockX && x < blockX + blockWidth) ||
         (gameOperation === 'minus' && x <= blockX && x > blockX + blockWidth)
       )
         return true;
@@ -1355,7 +1356,8 @@ const circleOne = {
     isOverRoad: function (x, y, roadX, roadWidth) {
       if (y > 150) {
         if (
-          (gameOperation === 'plus' && x >= roadX && x < roadX + roadWidth) ||
+          gameOperation === 'plus' ||
+          (gameOperation === 'mixed' && x >= roadX && x < roadX + roadWidth) ||
           (gameOperation === 'minus' &&
             x <= roadX &&
             x > roadX + roadWidth * self.control.directionModifier)
@@ -1367,7 +1369,8 @@ const circleOne = {
     /** TODO */
     fillCurrentBlock: function (x, blockX, block) {
       block.fillColor =
-        (gameOperation === 'plus' && x > blockX) ||
+        gameOperation === 'plus' ||
+        (gameOperation === 'mixed' && x > blockX) ||
         (gameOperation === 'minus' && x < blockX)
           ? colors.red
           : 'transparent';
@@ -1443,6 +1446,7 @@ const circleOne = {
           self.road.x,
           self.road.width
         );
+        console.log(isValidX);
         if (isValidX) {
           // GAME MODE A : balloon follow mouse
           self.blocks.cur = self.blocks.list[0];