From 17afceee4797ba0b153552ae6884f0572022ef2a Mon Sep 17 00:00:00 2001 From: Renge Date: Sat, 23 Apr 2022 21:54:28 -0400 Subject: [PATCH] fix: timer --- src/shattered_sword/Scenes/GameLevel.ts | 29 ++++++++++++------------- src/shattered_sword/Scenes/Tutorial.ts | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 25110cd..b48fa36 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -266,25 +266,25 @@ export default class GameLevel extends Scene { if (this.gameStateStack.peek() === GameState.GAMING) { if (this.gameStarted) { GameLevel.gameTimer += deltaT; - let minutes = Math.floor(GameLevel.gameTimer / 60); - if (minutes >= 10) { - this.timerLable.text = minutes.toString(); - } - else { - this.timerLable.text = "0" + minutes.toString(); - } - let seconds = Math.floor(GameLevel.gameTimer % 60); - if (seconds >= 10) { - this.timerLable.text += ":" + seconds.toString(); - } - else { - this.timerLable.text += ":0" + seconds.toString(); - } this.timerLable.textColor = Color.BLACK; } else { this.timerLable.textColor = Color.RED; } + let minutes = Math.floor(GameLevel.gameTimer / 60); + if (minutes >= 10) { + this.timerLable.text = minutes.toString(); + } + else { + this.timerLable.text = "0" + minutes.toString(); + } + let seconds = Math.floor(GameLevel.gameTimer % 60); + if (seconds >= 10) { + this.timerLable.text += ":" + seconds.toString(); + } + else { + this.timerLable.text += ":0" + seconds.toString(); + } } // Handle events and update the UI if needed @@ -1075,7 +1075,6 @@ export default class GameLevel extends Scene { this.touchedStartCheckPoint = true; this.storyLoader("shattered_sword_assets/jsons/story.json"); this.startTimer(); - this.levelEnded = true; } } diff --git a/src/shattered_sword/Scenes/Tutorial.ts b/src/shattered_sword/Scenes/Tutorial.ts index 7055d8a..d34fbb4 100644 --- a/src/shattered_sword/Scenes/Tutorial.ts +++ b/src/shattered_sword/Scenes/Tutorial.ts @@ -59,6 +59,6 @@ export default class Tutorial extends GameLevel { protected goToNextLevel(): void { this.viewport.setZoomLevel(1); - this.sceneManager.changeToScene(MainMenu); + this.sceneManager.changeToScene(Porcelain); } } \ No newline at end of file