feat: snake apply poison damage

This commit is contained in:
Renge 2022-04-27 22:43:44 -04:00
parent 3bf7704528
commit 1e5aa43383

View File

@ -1,4 +1,5 @@
import AnimatedSprite from "../../Wolfie2D/Nodes/Sprites/AnimatedSprite";
import PlayerController from "../Player/PlayerController";
import EnemyAI, { EnemyStates } from "./EnemyAI";
import SnakeAttack from "./EnemyStates/SnakeAttack";
@ -7,4 +8,11 @@ export default class SnakeAI extends EnemyAI {
super.initializeAI(owner, options);
this.addState(EnemyStates.ATTACK, new SnakeAttack(this, owner));
}
collideWithPlayer(player: PlayerController): void {
player.damage(10);
if (this.isAttaking && !player.invincible && !player.godMode) {
player.poisonCounter = 5;
}
}
}