|
@@ -35,26 +35,25 @@ class Valise2Tutorial extends Object2D
|
|
this.backButton.connect("mouseClicked", this, "_onBackClicked");
|
|
this.backButton.connect("mouseClicked", this, "_onBackClicked");
|
|
this.addChild(this.backButton);
|
|
this.addChild(this.backButton);
|
|
|
|
|
|
- AssetHandler.loadTexture(this.levelData.questionCard.name, this.levelData.questionCard.path);
|
|
|
|
this.questionCard = new Valise2QuestionCard("QuestionCard");
|
|
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.questionCard.setPosition(1920 / 2, 300);
|
|
this.addChild(this.questionCard);
|
|
this.addChild(this.questionCard);
|
|
|
|
|
|
this.optionCards = new Object2D("OptionCards");
|
|
this.optionCards = new Object2D("OptionCards");
|
|
this.addChild(this.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());
|
|
randomSeed(Date.now());
|
|
idx = shuffle(idx);
|
|
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}`);
|
|
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.isAnswer = idx[i] == 0;
|
|
newCard.connect("selected", this, "_onCardSelected");
|
|
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;
|
|
newCard.selectable = false;
|
|
this.optionCards.addChild(newCard);
|
|
this.optionCards.addChild(newCard);
|
|
}
|
|
}
|
|
@@ -94,7 +93,7 @@ class Valise2Tutorial extends Object2D
|
|
case 2:
|
|
case 2:
|
|
this.timer.start(2);
|
|
this.timer.start(2);
|
|
break;
|
|
break;
|
|
- case 10:
|
|
|
|
|
|
+ case 9:
|
|
this._onBackClicked();
|
|
this._onBackClicked();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -113,8 +112,6 @@ class Valise2Tutorial extends Object2D
|
|
this.optionCards.children[1].mouseOver = false;
|
|
this.optionCards.children[1].mouseOver = false;
|
|
this.optionCards.children[2].selectable = false;
|
|
this.optionCards.children[2].selectable = false;
|
|
this.optionCards.children[2].mouseOver = false;
|
|
this.optionCards.children[2].mouseOver = false;
|
|
- this.optionCards.children[3].selectable = false;
|
|
|
|
- this.optionCards.children[3].mouseOver = false;
|
|
|
|
this.timer.start(0.5);
|
|
this.timer.start(0.5);
|
|
break;
|
|
break;
|
|
case 4:
|
|
case 4:
|
|
@@ -124,8 +121,6 @@ class Valise2Tutorial extends Object2D
|
|
this.optionCards.children[1].mouseOver = true;
|
|
this.optionCards.children[1].mouseOver = true;
|
|
this.optionCards.children[2].selectable = false;
|
|
this.optionCards.children[2].selectable = false;
|
|
this.optionCards.children[2].mouseOver = false;
|
|
this.optionCards.children[2].mouseOver = false;
|
|
- this.optionCards.children[3].selectable = false;
|
|
|
|
- this.optionCards.children[3].mouseOver = false;
|
|
|
|
this.timer.start(0.5);
|
|
this.timer.start(0.5);
|
|
break;
|
|
break;
|
|
case 5:
|
|
case 5:
|
|
@@ -135,8 +130,6 @@ class Valise2Tutorial extends Object2D
|
|
this.optionCards.children[1].mouseOver = false;
|
|
this.optionCards.children[1].mouseOver = false;
|
|
this.optionCards.children[2].selectable = true;
|
|
this.optionCards.children[2].selectable = true;
|
|
this.optionCards.children[2].mouseOver = true;
|
|
this.optionCards.children[2].mouseOver = true;
|
|
- this.optionCards.children[3].selectable = false;
|
|
|
|
- this.optionCards.children[3].mouseOver = false;
|
|
|
|
this.timer.start(0.5);
|
|
this.timer.start(0.5);
|
|
break;
|
|
break;
|
|
case 6:
|
|
case 6:
|
|
@@ -146,26 +139,12 @@ class Valise2Tutorial extends Object2D
|
|
this.optionCards.children[1].mouseOver = false;
|
|
this.optionCards.children[1].mouseOver = false;
|
|
this.optionCards.children[2].selectable = false;
|
|
this.optionCards.children[2].selectable = false;
|
|
this.optionCards.children[2].mouseOver = 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);
|
|
this.timer.start(2);
|
|
break;
|
|
break;
|
|
- case 8:
|
|
|
|
|
|
+ case 7:
|
|
this.optionCards.children[0].selected = true;
|
|
this.optionCards.children[0].selected = true;
|
|
this.optionCards.children[1].selected = true;
|
|
this.optionCards.children[1].selected = true;
|
|
this.optionCards.children[2].selected = true;
|
|
this.optionCards.children[2].selected = true;
|
|
- this.optionCards.children[3].selected = true;
|
|
|
|
this.timer.start(1);
|
|
this.timer.start(1);
|
|
break;
|
|
break;
|
|
}
|
|
}
|