From 51be51916bdbf1b962f8189f54f99de1ae0dcb87 Mon Sep 17 00:00:00 2001 From: Renge Date: Sun, 24 Apr 2022 22:29:15 -0400 Subject: [PATCH] feat: make SnakeAttack extend Attack --- .../AI/EnemyStates/SnakeAttack.ts | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/shattered_sword/AI/EnemyStates/SnakeAttack.ts b/src/shattered_sword/AI/EnemyStates/SnakeAttack.ts index 67a5d66..718ad2b 100644 --- a/src/shattered_sword/AI/EnemyStates/SnakeAttack.ts +++ b/src/shattered_sword/AI/EnemyStates/SnakeAttack.ts @@ -1,25 +1,16 @@ import EnemyAI, { EnemyStates } from "../EnemyAI"; import EnemyState from "./EnemyState"; import AnimatedSprite from "../../../Wolfie2D/Nodes/Sprites/AnimatedSprite"; -import Shape from "../../../Wolfie2D/DataTypes/Shapes/Shape"; -import Vec2 from "../../../Wolfie2D/DataTypes/Vec2"; import AABB from "../../../Wolfie2D/DataTypes/Shapes/AABB"; import Sprite from "../../../Wolfie2D/Nodes/Sprites/Sprite"; +import Attack from "./Attack"; -export default class Attack extends EnemyState { +export default class SnakeAttack extends Attack { protected charged: string; protected attacked: string; onEnter(options: Record): void { - this.parent.attackTimer.start(); - this.parent.velocity.x = 0; - this.charged = this.owner.id+"charged"; - this.attacked = this.owner.id+"attacked"; - - // TODO replace DYING with CHARGING - (this.owner).animation.play("DYING", false, this.charged); - this.receiver.subscribe(this.charged); - this.receiver.subscribe(this.attacked); + super.onEnter(options); } update(deltaT: number): void { @@ -36,7 +27,6 @@ export default class Attack extends EnemyState { break; } } - console.log(this.parent.direction); (this.owner).invertX = this.parent.direction === 1 ? true : false ; }