فهرست منبع

✨ Make Valise 2 tutorial

Pedro Tonini Rosenberg Schneider 3 سال پیش
والد
کامیت
c83509d7a3

+ 9 - 30
src/elements/earth/valise2/tutorial/Valise2Tutorial.js

@@ -35,26 +35,25 @@ class Valise2Tutorial extends Object2D
         this.backButton.connect("mouseClicked", this, "_onBackClicked");
         this.addChild(this.backButton);
 
-        AssetHandler.loadTexture(this.levelData.questionCard.name, this.levelData.questionCard.path);
         this.questionCard = new Valise2QuestionCard("QuestionCard");
-        this.questionCard.thumb = AssetHandler.getTextureByName(this.levelData.questionCard.name);
+        this.questionCard.str = this.levelData.questionCard.name + "\n🗢";
         this.questionCard.setPosition(1920 / 2, 300);
         this.addChild(this.questionCard);
 
         this.optionCards = new Object2D("OptionCards");
         this.addChild(this.optionCards);
-        var idx = [0, 1, 2, 3];
+        var idx = [];
+        for (let i = 0; i < this.levelData.optionCards.length; i++)
+            idx.push(i);
         randomSeed(Date.now());
         idx = shuffle(idx);
-        for (let i = 0; i < 4; i++)
+        for (let i = 0; i < this.levelData.optionCards.length; i++)
         {
-            AssetHandler.loadTexture(this.levelData.optionCards[idx[i]].name, this.levelData.optionCards[idx[i]].path);
             var newCard = new Valise2OptionCard(`OptionCard${i}`);
-            newCard.thumb = AssetHandler.getTextureByName(this.levelData.optionCards[idx[i]].name);
-            newCard.setPosition((i + 1) * 1920 / 5, 800);
+            newCard.setPosition((i + 1) * 1920 / (this.levelData.optionCards.length + 1), 800);
             newCard.isAnswer = idx[i] == 0;
             newCard.connect("selected", this, "_onCardSelected");
-            newCard.str = this.levelData.optionCards[idx[i]].name;
+            newCard.str = this.levelData.optionCards[idx[i]].name + "\n🗢";
             newCard.selectable = false;
             this.optionCards.addChild(newCard);
         }
@@ -94,7 +93,7 @@ class Valise2Tutorial extends Object2D
             case 2:
                 this.timer.start(2);
                 break;
-            case 10:
+            case 9:
                 this._onBackClicked();
                 break;
         }
@@ -113,8 +112,6 @@ class Valise2Tutorial extends Object2D
                 this.optionCards.children[1].mouseOver = false;
                 this.optionCards.children[2].selectable = false;
                 this.optionCards.children[2].mouseOver = false;
-                this.optionCards.children[3].selectable = false;
-                this.optionCards.children[3].mouseOver = false;
                 this.timer.start(0.5);
                 break;
             case 4:
@@ -124,8 +121,6 @@ class Valise2Tutorial extends Object2D
                 this.optionCards.children[1].mouseOver = true;
                 this.optionCards.children[2].selectable = false;
                 this.optionCards.children[2].mouseOver = false;
-                this.optionCards.children[3].selectable = false;
-                this.optionCards.children[3].mouseOver = false;
                 this.timer.start(0.5);
                 break;
             case 5:
@@ -135,8 +130,6 @@ class Valise2Tutorial extends Object2D
                 this.optionCards.children[1].mouseOver = false;
                 this.optionCards.children[2].selectable = true;
                 this.optionCards.children[2].mouseOver = true;
-                this.optionCards.children[3].selectable = false;
-                this.optionCards.children[3].mouseOver = false;
                 this.timer.start(0.5);
                 break;
             case 6:
@@ -146,26 +139,12 @@ class Valise2Tutorial extends Object2D
                 this.optionCards.children[1].mouseOver = false;
                 this.optionCards.children[2].selectable = false;
                 this.optionCards.children[2].mouseOver = false;
-                this.optionCards.children[3].selectable = true;
-                this.optionCards.children[3].mouseOver = true;
-                this.timer.start(0.5);
-                break;
-            case 7:
-                this.optionCards.children[0].selectable = false;
-                this.optionCards.children[0].mouseOver = false;
-                this.optionCards.children[1].selectable = false;
-                this.optionCards.children[1].mouseOver = false;
-                this.optionCards.children[2].selectable = false;
-                this.optionCards.children[2].mouseOver = false;
-                this.optionCards.children[3].selectable = false;
-                this.optionCards.children[3].mouseOver = false;
                 this.timer.start(2);
                 break;
-            case 8:
+            case 7:
                 this.optionCards.children[0].selected = true;
                 this.optionCards.children[1].selected = true;
                 this.optionCards.children[2].selected = true;
-                this.optionCards.children[3].selected = true;
                 this.timer.start(1);
                 break;
         }

+ 4 - 4
src/elements/earth/valise2/tutorial/Valise2TutorialDialogue.js

@@ -43,23 +43,23 @@ class Valise2TutorialDialogue extends Object2D
             case 1:
                 this.bgOpacity = min(this.bgOpacity + 150 * delta, 200);
                 this.textOpacity = min(this.textOpacity + 150 * delta, 255);
-                this.text = "Qual é a palavra escondida em CUTIA?"
+                this.text = "Qual é a palavra escondida em CANA?"
                 if (this.textOpacity == 255) this.continueButton.show();
                 break;
             case 2:
                 this.continueButton.hide();
                 this.bgOpacity = max(this.bgOpacity - 150 * delta, 0);
                 this.textOpacity = max(this.textOpacity - 150 * delta, 0);
-                this.text = "Qual é a palavra escondida em CUTIA?"
+                this.text = "Qual é a palavra escondida em CANA?"
                 break;
             case 3:
                 this.bgOpacity = 0;
                 this.textOpacity = 0;
                 break;
-            case 9:
+            case 8:
                 this.bgOpacity = min(this.bgOpacity + 150 * delta, 200);
                 this.textOpacity = min(this.textOpacity + 150 * delta, 255);
-                this.text = "A palavra escondida em CUTIA é TIA.\n\nAgora é sua vez!"
+                this.text = "A palavra escondida em CANA é ANA.\n\nAgora é sua vez!"
                 if (this.textOpacity == 255) this.continueButton.show();
                 break;
         }

+ 1 - 2
src/main.js

@@ -30,8 +30,7 @@ GameHandler._setup = function()
     GameHandler.drawDebugBufferBounds(true);
     textFont("Lato");
 
-    var vg = new Valise2Game("Valise2Game");
-    vg.levelData = VALISE2_LEVELS.tutorial;
+    var vg = new Valise2LevelSelector("Valise2Game");
     GameHandler.addRootObject(vg);
 
     // var menu = new EelementSelector("ElementSelector");