ShatteredSword/src/shattered_sword/Scenes/GameOver.ts

31 lines
1.2 KiB
TypeScript
Raw Normal View History

import Vec2 from "../../Wolfie2D/DataTypes/Vec2";
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";
2022-04-23 22:34:17 -04:00
import { GameState } from "../sword_enums";
2022-04-23 22:06:52 -04:00
import InputWrapper from "../Tools/InputWrapper";
import MainMenu from "./MainMenu";
export default class GameOver extends Scene {
startScene() {
2022-04-23 22:34:17 -04:00
InputWrapper.setState(GameState.PAUSE);
const center = this.viewport.getCenter();
this.addUILayer("primary");
2022-04-23 22:06:52 -04:00
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);
}
}
}