fix: timer
This commit is contained in:
parent
8e68d60dba
commit
17afceee47
|
@ -266,25 +266,25 @@ 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;
|
||||||
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;
|
this.timerLable.textColor = Color.BLACK;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.timerLable.textColor = Color.RED;
|
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
|
// 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