diff --git a/src/shattered_sword/AI/EnemyStates/SlimeAttack.ts b/src/shattered_sword/AI/EnemyStates/SlimeAttack.ts index 35e0421..9f080c3 100644 --- a/src/shattered_sword/AI/EnemyStates/SlimeAttack.ts +++ b/src/shattered_sword/AI/EnemyStates/SlimeAttack.ts @@ -3,18 +3,12 @@ import AnimatedSprite from "../../../Wolfie2D/Nodes/Sprites/AnimatedSprite"; import Attack from "./Attack"; export default class SlimeAttack extends Attack { + onEnter(options: Record): void { + } update(deltaT: number): void { - while (this.receiver.hasNextEvent()) { - let event = this.receiver.getNextEvent().type; - switch (event) { - case this.charged: - (this.owner).animation.play("ATTACK", false, this.attacked); - break; - case this.attacked: - this.finished(EnemyStates.ALERT); - break; - } - } - super.update(deltaT); + this.finished(EnemyStates.ALERT); + } + onExit(): Record { + return null; } } \ No newline at end of file diff --git a/src/shattered_sword/AI/SlimeAI.ts b/src/shattered_sword/AI/SlimeAI.ts new file mode 100644 index 0000000..008aec0 --- /dev/null +++ b/src/shattered_sword/AI/SlimeAI.ts @@ -0,0 +1,10 @@ +import AnimatedSprite from "../../Wolfie2D/Nodes/Sprites/AnimatedSprite"; +import EnemyAI, { EnemyStates } from "./EnemyAI"; +import SlimeAttack from "./EnemyStates/SlimeAttack"; + +export default class SlimeAI extends EnemyAI { + initializeAI(owner: AnimatedSprite, options: Record): void { + super.initializeAI(owner, options); + this.addState(EnemyStates.ATTACK, new SlimeAttack(this, owner)); + } +} \ No newline at end of file diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 9f65162..da074f6 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -21,6 +21,7 @@ import Weapon from "../GameSystems/items/Weapon"; import BattleManager from "../GameSystems/BattleManager"; import EnemyAI from "../AI/EnemyAI"; import SnakeAI from "../AI/SnakeAI"; +import SlimeAI from "../AI/SlimeAI"; import BattlerAI from "../AI/BattlerAI"; import InventoryManager from "../GameSystems/InventoryManager"; import Item from "../GameSystems/items/Item"; @@ -907,7 +908,7 @@ export default class GameLevel extends Scene { }) break; case "black_pudding": - this.addEnemy("black_pudding", enemy.position.scale(32), EnemyAI, { + this.addEnemy("black_pudding", enemy.position.scale(32), SlimeAI, { player: this.player, health: 200, tilemap: "Main",