Fix: stage timer - add bonus time, smoke particle

This commit is contained in:
2018-11-02 10:18:41 +09:00
parent cd70136b91
commit 5f82d6ccae
6 changed files with 57 additions and 116 deletions
+16 -1
View File
@@ -3,6 +3,7 @@ function StageTimer(stageTimerSec, onTimeOver) {
this.onTimeOver = onTimeOver;
this.isPaused = false;
this.timeLeft = this.stageTimerSec;
var fontStyle = StageTimer.DEFAULT_TEXT_FONT;
@@ -22,6 +23,11 @@ function StageTimer(stageTimerSec, onTimeOver) {
// this.label.strokeThickness = 3;
this.timerEvent = null;
var textStyle = { font: "bold 64px Arial", fill: "#ff0", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
this.bonusTimeText = game.add.text(game.world.centerX, game.world.centerY, "보너스 타임", textStyle);
this.bonusTimeText.anchor.set(0.5);
this.bonusTimeText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
};
StageTimer.prototype.start = function() {
@@ -67,11 +73,20 @@ StageTimer.prototype.removeTimer = function() {
this.timerEvent = null;
}
StageTimer.prototype.add = function(timeSec) {
StageTimer.prototype.addTime = function(timeSec) {
this.timeLeft += timeSec;
this.printTime();
}
StageTimer.prototype.addBonusTime = function(timeSec) {
this.addTime(timeSec);
game.world.bringToTop(this.bonusTimeText);
this.bonusTimeText.text = "+" + timeSec + "초 추가";
this.bonusTimeText.alpha = 1;
game.add.tween(this.bonusTimeText).to({alpha: 0}, Phaser.Timer.SECOND * 1.5, Phaser.Easing.Quintic.In, true);
}
StageTimer.FONT_HEIGHT_PX = 70;