fix: slime don't have a charge state
This commit is contained in:
parent
76ac59ac9c
commit
bc625b9530
|
@ -3,18 +3,12 @@ import AnimatedSprite from "../../../Wolfie2D/Nodes/Sprites/AnimatedSprite";
|
|||
import Attack from "./Attack";
|
||||
|
||||
export default class SlimeAttack extends Attack {
|
||||
onEnter(options: Record<string, any>): void {
|
||||
}
|
||||
update(deltaT: number): void {
|
||||
while (this.receiver.hasNextEvent()) {
|
||||
let event = this.receiver.getNextEvent().type;
|
||||
switch (event) {
|
||||
case this.charged:
|
||||
(<AnimatedSprite>this.owner).animation.play("ATTACK", false, this.attacked);
|
||||
break;
|
||||
case this.attacked:
|
||||
this.finished(EnemyStates.ALERT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
super.update(deltaT);
|
||||
onExit(): Record<string, any> {
|
||||
return null;
|
||||
}
|
||||
}
|
10
src/shattered_sword/AI/SlimeAI.ts
Normal file
10
src/shattered_sword/AI/SlimeAI.ts
Normal file
|
@ -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<string, any>): void {
|
||||
super.initializeAI(owner, options);
|
||||
this.addState(EnemyStates.ATTACK, new SlimeAttack(this, owner));
|
||||
}
|
||||
}
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user