NimbusNiles / RogueDixie

3 stars 0 forks source link

Not every attack is a damage-dealing hit #14

Closed TimmPure closed 7 years ago

TimmPure commented 7 years ago

Wanted behaviour: every time the player clicks, performing a melee attack, and the enemy and weapon's hitboxes intersect, you deal damage.

Actual behaviour: sometimes a consecutive hit does not trigger a new collision, thus not dealing new damage.

Probable cause: when the sword's box collider does not exit the collision at/before the end of a melee attack animation, AND does not start from outside the enemy's hitbox at the consecutive attack, there was never an OnTriggerExit2D, thus not calling a new OnTriggerEnter2D.

Possible solution: disable the melee attack's box collider for a single frame/(fixed)update call at the end of the animation?

TimmPure commented 7 years ago

Box collider of weapon not corresponding with the sprite. Might be the cause?