fix: timer

This commit is contained in:
Renge 2022-04-23 21:54:28 -04:00
parent 8e68d60dba
commit 17afceee47
2 changed files with 15 additions and 16 deletions

View File

@ -266,6 +266,11 @@ export default class GameLevel extends Scene {
if (this.gameStateStack.peek() === GameState.GAMING) {
if (this.gameStarted) {
GameLevel.gameTimer += deltaT;
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();
@ -280,11 +285,6 @@ export default class GameLevel extends Scene {
else {
this.timerLable.text += ":0" + seconds.toString();
}
this.timerLable.textColor = Color.BLACK;
}
else {
this.timerLable.textColor = Color.RED;
}
}
// 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;
}
}

View File

@ -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);
}
}