From 1c42c88f2fd89cbeecd1a87fb8f9f7c6f41428b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Fri, 2 Nov 2018 10:29:07 +0900 Subject: [PATCH] Add: add bonus time to card matching --- src/game/lib/stage_timer.js | 11 +++++++---- src/game/mouse/card_matching/game.js | 9 +++++++-- src/game/mouse/grilled_meat/game.js | 3 +-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/game/lib/stage_timer.js b/src/game/lib/stage_timer.js index d133fe4..24c73c6 100644 --- a/src/game/lib/stage_timer.js +++ b/src/game/lib/stage_timer.js @@ -24,9 +24,12 @@ function StageTimer(stageTimerSec, onTimeOver) { 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); + 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.alpha = 0; 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); }; @@ -82,9 +85,9 @@ StageTimer.prototype.addBonusTime = function(timeSec) { this.addTime(timeSec); game.world.bringToTop(this.bonusTimeText); - this.bonusTimeText.text = "+" + timeSec + "초 추가"; + this.bonusTimeText.text = "시간 보너스\n+" + timeSec + "초 추가"; 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); } diff --git a/src/game/mouse/card_matching/game.js b/src/game/mouse/card_matching/game.js index 95581ae..353877a 100644 --- a/src/game/mouse/card_matching/game.js +++ b/src/game/mouse/card_matching/game.js @@ -474,8 +474,11 @@ var Game = { checkStageCleared: function() { this.clearedCardCount += 2; - if(this.activatedCardCount == this.clearedCardCount) + if(this.activatedCardCount == this.clearedCardCount) { + this.stageTimer.addBonusTime(this.getBonusTime()); + this.startNextStage(); + } }, resetDifferentTwoCards: function() { @@ -532,7 +535,9 @@ var Game = { return this.playingStageNo * 10; }, - + getBonusTime: function() { + return this.playingStageNo; + }, gameOver: function() { diff --git a/src/game/mouse/grilled_meat/game.js b/src/game/mouse/grilled_meat/game.js index ea84959..cbc1d10 100644 --- a/src/game/mouse/grilled_meat/game.js +++ b/src/game/mouse/grilled_meat/game.js @@ -255,8 +255,7 @@ var Game = { }, clearStage: function() { - var bonusTime = this.getBonusTime(); - this.stageTimer.addBonusTime(bonusTime); + this.stageTimer.addBonusTime(this.getBonusTime()); this.playingStageNo++;