Add: card matching combo bonus

This commit is contained in:
2019-01-29 21:57:42 +09:00
parent 90d6e55428
commit f7dc4bce71
3 changed files with 109 additions and 2 deletions
+27 -2
View File
@@ -56,6 +56,7 @@ var Game = {
this.initVariables();
this.comboText = new ComboText();
// game stage
game.stage.backgroundColor = '#4d4d4d';
@@ -105,6 +106,8 @@ var Game = {
this.cardCharacterIndexList;
this.randStageCharacterList;
this.randCharacterListAfterShuffling;
this.comboCount = 0;
},
initCardVariables: function() {
@@ -361,10 +364,14 @@ var Game = {
this.setOpenCardInfo(col, row);
if(this.isCardSelectEdgeAll() == true) { // selected 2 cards
if(this.isSameCharacterCard() == true) // selected same cards
if(this.isSameCharacterCard() == true) { // selected same cards
this.clearSameTwoCards();
else // selected different cards
this.increaseComboCount();
this.addComboBonus();
} else { // selected different cards
this.resetDifferentTwoCards();
this.resetComboBonus();
}
}
}
@@ -500,6 +507,24 @@ var Game = {
increaseComboCount: function() {
this.comboCount++;
},
addComboBonus: function() {
if(this.comboCount < 2)
return;
var comboBonusScore = this.comboCount * 10;
this.comboText.show(this.comboCount, comboBonusScore);
},
resetComboBonus: function() {
this.comboCount = 0;
},
setOpenCardInfo: function(col, row) {
var cardIndex = this.getCardIndex(col, row);