Add: add bonus time to card matching
This commit is contained in:
@@ -24,9 +24,12 @@ function StageTimer(stageTimerSec, onTimeOver) {
|
|||||||
|
|
||||||
this.timerEvent = null;
|
this.timerEvent = null;
|
||||||
|
|
||||||
var textStyle = { font: "bold 64px Arial", fill: "#ff0", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
var textStyle = { font: "bold 52px Arial", fill: "#ffd700", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||||
this.bonusTimeText = game.add.text(game.world.centerX, game.world.centerY, "보너스 타임", textStyle);
|
this.bonusTimeText = game.add.text(game.world.centerX, game.world.centerY, "", textStyle);
|
||||||
|
this.bonusTimeText.alpha = 0;
|
||||||
this.bonusTimeText.anchor.set(0.5);
|
this.bonusTimeText.anchor.set(0.5);
|
||||||
|
this.bonusTimeText.stroke = '#000';
|
||||||
|
this.bonusTimeText.strokeThickness = 6;
|
||||||
this.bonusTimeText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
this.bonusTimeText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -82,9 +85,9 @@ StageTimer.prototype.addBonusTime = function(timeSec) {
|
|||||||
this.addTime(timeSec);
|
this.addTime(timeSec);
|
||||||
|
|
||||||
game.world.bringToTop(this.bonusTimeText);
|
game.world.bringToTop(this.bonusTimeText);
|
||||||
this.bonusTimeText.text = "+" + timeSec + "초 추가";
|
this.bonusTimeText.text = "시간 보너스\n+" + timeSec + "초 추가";
|
||||||
this.bonusTimeText.alpha = 1;
|
this.bonusTimeText.alpha = 1;
|
||||||
game.add.tween(this.bonusTimeText).to({alpha: 0}, Phaser.Timer.SECOND * 1.5, Phaser.Easing.Quintic.In, true);
|
game.add.tween(this.bonusTimeText).to({alpha: 0}, Phaser.Timer.SECOND, Phaser.Easing.Quintic.In, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -474,8 +474,11 @@ var Game = {
|
|||||||
|
|
||||||
checkStageCleared: function() {
|
checkStageCleared: function() {
|
||||||
this.clearedCardCount += 2;
|
this.clearedCardCount += 2;
|
||||||
if(this.activatedCardCount == this.clearedCardCount)
|
if(this.activatedCardCount == this.clearedCardCount) {
|
||||||
|
this.stageTimer.addBonusTime(this.getBonusTime());
|
||||||
|
|
||||||
this.startNextStage();
|
this.startNextStage();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetDifferentTwoCards: function() {
|
resetDifferentTwoCards: function() {
|
||||||
@@ -532,7 +535,9 @@ var Game = {
|
|||||||
return this.playingStageNo * 10;
|
return this.playingStageNo * 10;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getBonusTime: function() {
|
||||||
|
return this.playingStageNo;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
gameOver: function() {
|
gameOver: function() {
|
||||||
|
|||||||
@@ -255,8 +255,7 @@ var Game = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
clearStage: function() {
|
clearStage: function() {
|
||||||
var bonusTime = this.getBonusTime();
|
this.stageTimer.addBonusTime(this.getBonusTime());
|
||||||
this.stageTimer.addBonusTime(bonusTime);
|
|
||||||
|
|
||||||
this.playingStageNo++;
|
this.playingStageNo++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user