fix: bugs in GameOver

This commit is contained in:
Renge 2022-04-23 22:06:52 -04:00
parent 17afceee47
commit c5e40103a2
2 changed files with 16 additions and 3 deletions

View File

@ -359,7 +359,9 @@ export default class GameLevel extends Scene {
this.respawnPlayer();
}
else{ //no more lives
this.viewport.setZoomLevel(1);
this.sceneManager.changeToScene(GameOver, {});
InputWrapper.enableInput();
}
break;
case "startStory":

View File

@ -1,9 +1,10 @@
import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
import Input from "../../Wolfie2D/Input/Input";
import Label from "../../Wolfie2D/Nodes/UIElements/Label";
import { UIElementType } from "../../Wolfie2D/Nodes/UIElements/UIElementTypes";
import Scene from "../../Wolfie2D/Scene/Scene";
import Color from "../../Wolfie2D/Utils/Color";
import InputWrapper from "../Tools/InputWrapper";
import MainMenu from "./MainMenu";
export default class GameOver extends Scene {
@ -12,7 +13,17 @@ export default class GameOver extends Scene {
this.addUILayer("primary");
const gameOver = <Label>this.add.uiElement(UIElementType.LABEL, "primary", {position: new Vec2(center.x, center.y), text: "Game Over"});
gameOver.textColor = Color.WHITE;
const gameOver = <Label>this.add.uiElement(UIElementType.LABEL, "primary", {position: new Vec2(center.x, center.y), text: "YOU DIED"});
gameOver.textColor = Color.RED;
gameOver.fontSize = 100;
const hint = <Label>this.add.uiElement(UIElementType.LABEL, "primary", {position: new Vec2(center.x, center.y + 100), text: "Click to go back to Main Menu"});
hint.textColor = Color.WHITE;
}
updateScene(){
if(InputWrapper.isLeftMouseJustPressed()){
this.sceneManager.changeToScene(MainMenu);
}
}
}