From 61ba24da756fa22a9c97fd8164f66c65e41bba51 Mon Sep 17 00:00:00 2001 From: Renge Date: Tue, 19 Apr 2022 12:10:21 -0400 Subject: [PATCH] fix: add invicibility to shield --- src/shattered_sword/Player/PlayerController.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shattered_sword/Player/PlayerController.ts b/src/shattered_sword/Player/PlayerController.ts index 65c433c..678eb56 100644 --- a/src/shattered_sword/Player/PlayerController.ts +++ b/src/shattered_sword/Player/PlayerController.ts @@ -104,6 +104,9 @@ export default class PlayerController extends StateMachineAI implements BattlerA // TODO - figure out attacker damage(damage: number, attacker?: GameNode): void { if( !this.invincible){ + //i frame here + PlayerController.invincibilityTimer.start(); + this.invincible = true; //shield absorbs the damage and sends dmg back to attacker if(this.CURRENT_SHIELD > 0){ let newshield = Math.max(0, this.CURRENT_SHIELD - damage ); //calculate the new shield value @@ -113,9 +116,6 @@ export default class PlayerController extends StateMachineAI implements BattlerA this.CURRENT_SHIELD = newshield; //update shield value } else{ - //i frame here - PlayerController.invincibilityTimer.start(); - this.invincible = true; //console.log("hurt anim"); (this.owner).animation.play("HURT" ); this.CURRENT_HP -= damage;