fix: timer
This commit is contained in:
parent
8e68d60dba
commit
17afceee47
|
@ -266,6 +266,11 @@ export default class GameLevel extends Scene {
|
||||||
if (this.gameStateStack.peek() === GameState.GAMING) {
|
if (this.gameStateStack.peek() === GameState.GAMING) {
|
||||||
if (this.gameStarted) {
|
if (this.gameStarted) {
|
||||||
GameLevel.gameTimer += deltaT;
|
GameLevel.gameTimer += deltaT;
|
||||||
|
this.timerLable.textColor = Color.BLACK;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.timerLable.textColor = Color.RED;
|
||||||
|
}
|
||||||
let minutes = Math.floor(GameLevel.gameTimer / 60);
|
let minutes = Math.floor(GameLevel.gameTimer / 60);
|
||||||
if (minutes >= 10) {
|
if (minutes >= 10) {
|
||||||
this.timerLable.text = minutes.toString();
|
this.timerLable.text = minutes.toString();
|
||||||
|
@ -280,11 +285,6 @@ export default class GameLevel extends Scene {
|
||||||
else {
|
else {
|
||||||
this.timerLable.text += ":0" + seconds.toString();
|
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
|
// Handle events and update the UI if needed
|
||||||
|
@ -1075,7 +1075,6 @@ export default class GameLevel extends Scene {
|
||||||
this.touchedStartCheckPoint = true;
|
this.touchedStartCheckPoint = true;
|
||||||
this.storyLoader("shattered_sword_assets/jsons/story.json");
|
this.storyLoader("shattered_sword_assets/jsons/story.json");
|
||||||
this.startTimer();
|
this.startTimer();
|
||||||
this.levelEnded = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,6 @@ export default class Tutorial extends GameLevel {
|
||||||
|
|
||||||
protected goToNextLevel(): void {
|
protected goToNextLevel(): void {
|
||||||
this.viewport.setZoomLevel(1);
|
this.viewport.setZoomLevel(1);
|
||||||
this.sceneManager.changeToScene(MainMenu);
|
this.sceneManager.changeToScene(Porcelain);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user