Class BossDeathComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.enemy.BossDeathComponent

public class BossDeathComponent extends Component
Plays a one-shot explosion animation when the owning Boss entity dies, then disposes the temporary effect entity and the Boss entity itself safely.

Assumptions: - The texture atlas "images/boss_explosion.atlas" is preloaded in ResourceService. - The atlas contains regions named "boss_explosion" with sequential indices (0..N). - The game's rendering uses nearest filtering for crisp pixel-art (as set in the atlas).

  • Constructor Details

    • BossDeathComponent

      public BossDeathComponent()
      Default configuration: 0.06s per frame, scaled up 4×. Suitable for a large, impactful explosion without being too slow.
    • BossDeathComponent

      public BossDeathComponent(float frameDuration, float scaleMultiplier)
      Custom configuration.
      Parameters:
      frameDuration - Seconds per frame, clamped to a small positive value.
      scaleMultiplier - Scale multiplier for the explosion entity; integer values keep pixel-art crisp.
  • Method Details

    • create

      public void create()
      Subscribes to the owning entity's "death" event when the component is created. When "death" is triggered elsewhere (e.g., in the health/combat system), this component will spawn and play the explosion.
      Overrides:
      create in class Component