Add: card matching combo bonus
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user