diff --git a/src/shattered_sword/AI/BullAI.ts b/src/shattered_sword/AI/BullAI.ts index c72d64b..a661462 100644 --- a/src/shattered_sword/AI/BullAI.ts +++ b/src/shattered_sword/AI/BullAI.ts @@ -1,6 +1,7 @@ import Vec2 from "../../Wolfie2D/DataTypes/Vec2"; import AnimatedSprite from "../../Wolfie2D/Nodes/Sprites/AnimatedSprite"; import Timer from "../../Wolfie2D/Timing/Timer"; +import PlayerController from "../Player/PlayerController"; import EnemyAI, { EnemyStates } from "./EnemyAI"; import BullAttack from "./EnemyStates/BullAttack"; @@ -11,11 +12,10 @@ export default class BullAI extends EnemyAI { this.attackTimer = new Timer(4000); } - canAttack(position: Vec2): boolean { - return this.attackTimer.isStopped(); - } - - getPlayerPosition(): Vec2 { - return this.player.position; + collideWithPlayer(player: PlayerController): void { + player.damage(10); + if (this.isAttaking && !player.invincible && !player.godMode) { + player.bleedCounter += 3; + } } } \ No newline at end of file diff --git a/src/shattered_sword/AI/TigerAI.ts b/src/shattered_sword/AI/TigerAI.ts index eac328a..c3e2be0 100644 --- a/src/shattered_sword/AI/TigerAI.ts +++ b/src/shattered_sword/AI/TigerAI.ts @@ -1,5 +1,6 @@ import Vec2 from "../../Wolfie2D/DataTypes/Vec2"; import AnimatedSprite from "../../Wolfie2D/Nodes/Sprites/AnimatedSprite"; +import PlayerController from "../Player/PlayerController"; import EnemyAI, { EnemyStates } from "./EnemyAI"; import TigerAttack from "./EnemyStates/TigerAttack"; @@ -9,11 +10,17 @@ export default class TigerAI extends EnemyAI { this.addState(EnemyStates.ATTACK, new TigerAttack(this, owner)); } - canAttack(position: Vec2): boolean { - return this.attackTimer.isStopped(); + getPlayerPosition(): Vec2 { + if (this.owner.position.distanceTo(this.player.position) <= 800) { + return this.player.position; + } + return null; } - getPlayerPosition(): Vec2 { - return this.player.position; + collideWithPlayer(player: PlayerController): void { + player.damage(10); + if (this.isAttaking && !player.invincible && !player.godMode) { + player.bleedCounter += 3; + } } } \ No newline at end of file