diff --git a/src/shattered_sword/AI/EnemyAI.ts b/src/shattered_sword/AI/EnemyAI.ts index 4d22b7d..02b277b 100644 --- a/src/shattered_sword/AI/EnemyAI.ts +++ b/src/shattered_sword/AI/EnemyAI.ts @@ -15,13 +15,14 @@ import Weapon from "../GameSystems/items/Weapon"; import BattlerAI from "./BattlerAI"; import Patrol from "./EnemyStates/Patrol"; -import { Statuses } from "../sword_enums"; +import { GameState, Statuses } from "../sword_enums"; import Sprite from "../../Wolfie2D/Nodes/Sprites/Sprite"; import MathUtils from "../../Wolfie2D/Utils/MathUtils"; import { Player_Events } from "../sword_enums"; +import InputWrapper from "../Tools/InputWrapper"; export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { /** The owner of this AI */ owner: AnimatedSprite; @@ -181,6 +182,9 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { update(deltaT: number){ + if (InputWrapper.getState() != GameState.GAMING) { + return; + } super.update(deltaT); // This is the plan that is executed in the Active state, so whenever we don't have a plan, acquire a new one given the current statuses the enemy has diff --git a/src/shattered_sword/Scenes/SplashScreen.ts b/src/shattered_sword/Scenes/SplashScreen.ts index ce93a24..25031c0 100644 --- a/src/shattered_sword/Scenes/SplashScreen.ts +++ b/src/shattered_sword/Scenes/SplashScreen.ts @@ -73,7 +73,7 @@ export default class MainMenu extends Scene { while(this.receiver.hasNextEvent()){ let event = this.receiver.getNextEvent(); console.log(event); - if (InputWrapper.isMouseJustPressed(0)) { //if left click + if (InputWrapper.isLeftMouseJustPressed()) { //if left click this.sceneManager.changeToScene(MainMenu, {}, {}); } diff --git a/src/shattered_sword/Tools/InputWrapper.ts b/src/shattered_sword/Tools/InputWrapper.ts index fd3ea5e..23a3023 100644 --- a/src/shattered_sword/Tools/InputWrapper.ts +++ b/src/shattered_sword/Tools/InputWrapper.ts @@ -136,8 +136,8 @@ export default class InputWrapper { return false; } - static isMouseJustPressed(mouseButton?: number): boolean{ - return Input.isMouseJustPressed(mouseButton); + static isLeftMouseJustPressed(): boolean{ + return Input.isMouseJustPressed(0); } static disableInput() { @@ -152,4 +152,7 @@ export default class InputWrapper { InputWrapper.gameState = gameState; } + static getState(): GameState { + return InputWrapper.gameState; + } } \ No newline at end of file