Health, Hit Reaction & Death Events (https: github.com UQcsse3200 2026‐studio‐4 issues 17) - UQcsse3200/2026-studio-4 GitHub Wiki

What has been implemented

  • Updated 'CombatStatsComponent' to handle 'takeDamage()' and emit the 'entityDied' event when health reaches zero.
  • Refactored 'hitReaction' event in 'CombatStatsComponent' to include the 'attacker' entity reference for directional hit processing.
  • Implemented 'KnockbackComponent' to apply physical linear impulses to our game upon receiveing hit events.
  • Added and updated unit tests for 'CombatstatsComponent' , 'KnockbackComponent' and 'EnemyDeathComponent'.

Integration / Interface Notes

  • 'CombatStatsComponent' now triggers ' "hitReaction'' (passing 'attacker') and '"entityDied"' events for other components to listen to.
  • 'KnockbackComponent' listens to '"hitReaction"' and requires 'PhysicsComponent' on the same entity to apply impulse forces.

Testing

'CombatStatsComponentTest': Verified damage calculation and death event triggers.

'KnocjbackComponentTest': Verified 'applyLinearImpulse' call on physics body when hit by an attacker.