feat: bull & tiger bleed dot

This commit is contained in:
Renge 2022-04-30 19:23:45 -04:00
parent a762810fdd
commit a226cb977b
2 changed files with 17 additions and 10 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}