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
+14 -86
View File
@@ -46,7 +46,6 @@ var Game = {
Game.GAME_TIME_SEC,
(function() {
this.setClickEnable(false);
this.showStageNotice("시간 종료");
this.gameOver();
}).bind(this)
);
@@ -60,11 +59,6 @@ var Game = {
this.plusScoreGroup = game.add.group();
var textStyle = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
this.stageNoticeText = game.add.text(0, 0, "", textStyle);
this.stageNoticeText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
this.stageNoticeText.setTextBounds(0, 60, 1000, 80);
var table = game.add.tileSprite(0, 340, GAME_SCREEN_SIZE.x, 660, 'wooden_table');
this.meatPlate = game.add.image(220, Game.MEAT_PLATE_POSITION_Y, 'plate');
this.meatPlate.anchor.set(0.5);
@@ -107,25 +101,12 @@ var Game = {
this.activatedMeatCount;
this.clearedMeatCount;
// this.score;
// this.scoreText;
// this.highscore;
// this.highscoreText;
this.plusScoreTextGroup;
this.stageNoticeText;
this.popup;
this.popupTween = null;
this.startButton;
// this.leftTimeText;
// this.leftTimeSec;
this.timeEvent;
this.gameTimeEvents = [];
this.meatCount;
},
@@ -170,32 +151,16 @@ var Game = {
this.playingStageNo = 1;
this.startStage();
this.stageTimer.start();
},
startStage: function() {
var bonusTime = this.getBonusTime();
this.showStageNotice(this.playingStageNo + "단계 시작 (제한 시간 : " + bonusTime + "초)");
this.clearedMeatCount = 0;
this.activatedMeatCount = this.getStageMeatCount();
this.serveMeats();
this.stageTimer.start();
},
startNextStage: function() {
var bonusTime = this.getBonusTime();
if(bonusTime == 0)
this.showStageNotice(this.playingStageNo + "단계 시작");
else
this.showStageNotice(this.playingStageNo + "단계 시작 (보너스 +" + bonusTime + "초)");
this.clearedMeatCount = 0;
this.activatedMeatCount = this.getStageMeatCount();
this.serveMeats();
},
setClickEnable: function(value) {
this.isEnableClick = value;
},
@@ -220,51 +185,11 @@ var Game = {
},
getBonusTime: function() {
if(this.playingStageNo == 1)
return Game.INIT_LEFT_TIME_MIN * 60;
var bonusTime = 0;
if(this.playingStageNo < 10)
bonusTime = Math.floor(10 / this.playingStageNo) * (Game.INIT_LEFT_TIME_MIN * 2);
return bonusTime;
},
// updateLeftTime: function() {
// this.leftTimeSec--;
// this.leftTimeText.text = this.leftTimeSec;
// if(this.leftTimeSec == 0) {
// this.showStageNotice("시간 종료");
// this.gameOver();
// }
// },
showStageNotice: function(text) {
this.stageNoticeText.alpha = 0;
this.stageNoticeText.text = text;
this.animateTextAlpha(this.stageNoticeText, 1, 0, Phaser.Timer.SECOND * 2, Phaser.Easing.Linear.None);
return this.playingStageNo * 4;
},
// addScore: function() {
// // this.score += 10 * this.playingStageNo;
// this.scoreManager.addScore(10 * this.playingStageNo);
// },
// updateScore: function() {
// this.scoreText.text = this.score;
// },
// updateHighscore: function() {
// if(this.score > this.highscore) {
// highscore = score;
// highscoreText.text = highscore;
// showStageNotice("!!! 최고 점수 갱신 !!!");
// }
// },
isOverHeatPlate: function(x, y, width, height) {
var plateHalfWidth = (this.heatPlate.width - Game.HEAT_PLATE_HANDLE_WIDTH) / 2;
var plateHalfHeight = this.heatPlate.height / 2;
@@ -309,11 +234,10 @@ var Game = {
if(meat.getMeatGrade() == Meat.DONENESS_WELLDONE) {
this.god.animateHappy(Meat.DONENESS_WELLDONE); // "맛있어♥♡♥");
// this.addScore();
// this.updateScore();
this.scoreManager.plusScore(10 * this.playingStageNo);
var score = 10 * this.playingStageNo;
this.scoreManager.plusScore(score);
var tempPlusScore = new PlusScore(this.god.x, this.god.y - 180, 10 * this.playingStageNo);
var tempPlusScore = new PlusScore(this.god.x, this.god.y - 180, score);
this.plusScoreGroup.add(tempPlusScore);
} else {
if(meat.getMeatGrade() == Meat.DONENESS_RARE) {
@@ -331,10 +255,12 @@ var Game = {
},
clearStage: function() {
this.showStageNotice(this.playingStageNo + "단계 완료");
var bonusTime = this.getBonusTime();
this.stageTimer.addBonusTime(bonusTime);
this.playingStageNo++;
var startStageTimeEvent = game.time.events.add(Phaser.Timer.SECOND * 1, this.startNextStage, this);
var startStageTimeEvent = game.time.events.add(Phaser.Timer.SECOND * 1, this.startStage, this);
this.gameTimeEvents[this.gameTimeEvents.length + 1] = startStageTimeEvent;
},
@@ -353,6 +279,10 @@ var Game = {
}
this.gameTimeEvents = [];
for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) {
this.meatGroup.children[i].hide();
}
var gameOverText = new GameOverText();
game.time.events.add(Phaser.Timer.SECOND * 2, this.goResult, this);
@@ -368,8 +298,6 @@ var Game = {
Game.GAME_TIME_SEC = 60;
Game.NEXT_STAGE_DELAY_MS = 500;
Game.INIT_LEFT_TIME_MIN = 2;
Game.MAX_MEAT_COUNT = 20;
Game.HEAT_PLATE_HANDLE_WIDTH = 440;