From cc3b005ae7155262205d821d8f0656f7ba31933b Mon Sep 17 00:00:00 2001 From: Renge Date: Tue, 19 Apr 2022 12:25:01 -0400 Subject: [PATCH] feat: game pause --- src/shattered_sword/Scenes/GameLevel.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 3b8374b..a4159d9 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -272,9 +272,17 @@ export default class GameLevel extends Scene { } } if (this.gameStateStack.peek() === GameState.STORY) { - if (InputWrapper.isNextJustPressed() && this.gameStateStack.peek() === GameState.STORY) { - this.updateStory(); - } + if (InputWrapper.isNextJustPressed() && this.gameStateStack.peek() === GameState.STORY) { + this.updateStory(); + } + } + if (InputWrapper.isPauseJustPressed()) { + if (this.gameStateStack.peek() === GameState.GAMING) { + this.setGameState(GameState.PAUSE); + } + else if (this.gameStateStack.peek() === GameState.PAUSE) { + this.setGameState(); + } } //update health UI