From 66f6a443ca3017d707b335e5fc7e5b73d1ae6c69 Mon Sep 17 00:00:00 2001 From: OfficialCHenry Date: Mon, 25 Apr 2022 22:02:41 -0400 Subject: [PATCH] added main menu button to pause menu --- src/shattered_sword/Scenes/GameLevel.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 77f49e2..8326222 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -40,6 +40,7 @@ import GameOver from "./GameOver"; import Porcelain from "./Porcelain"; import Tutorial from "./Tutorial"; import Greatwall from "./Greatwall"; +import MainMenu from "./MainMenu"; // TODO /** @@ -125,6 +126,7 @@ export default class GameLevel extends Scene { protected pauseInput: TextInput; protected pauseSubmit: Label; protected pauseCheatText: Label; + protected mainMenuButton: Button; protected rmg: RandomMapGenerator; protected map: TiledTilemapData; @@ -406,6 +408,11 @@ export default class GameLevel extends Scene { if (event.type === "cheat") { this.enableCheat(); } + if(event.type === "MainMenu"){ + this.viewport.setZoomLevel(1); + this.sceneManager.changeToScene(MainMenu, {}); + InputWrapper.enableInput(); + } } if (this.gameStateStack.peek() === GameState.STORY) { if (InputWrapper.isNextJustPressed() && this.gameStateStack.peek() === GameState.STORY) { @@ -543,6 +550,7 @@ export default class GameLevel extends Scene { this.receiver.subscribe("startTimer"); this.receiver.subscribe("endStory"); this.receiver.subscribe("nextLevel"); + this.receiver.subscribe("MainMenu"); } // TODO - @@ -678,6 +686,16 @@ export default class GameLevel extends Scene { this.pauseSubmit.onClickEventId = "cheat"; this.pauseSubmit.borderWidth = 3; + this.mainMenuButton =