Class Boss3HealthPhaseSwitcher

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.boss.Boss3HealthPhaseSwitcher

public class Boss3HealthPhaseSwitcher extends Component
A component that switches Boss-3's rendering from a static PNG

This allows the boss to visually "crack" or change form at 50%, 40%, and 25% health. The atlas is pre-attached during entity creation, but disabled until triggered.

The thresholds are ratios of current health / max health.

  • Constructor Details

    • Boss3HealthPhaseSwitcher

      public Boss3HealthPhaseSwitcher(String atlasPath, float frameDuration)
  • Method Details

    • addPhase

      public Boss3HealthPhaseSwitcher addPhase(float threshold, String animationName)
    • create

      public void create()
      Called when the component is created. Sorts thresholds in descending order and applies the correct phase immediately (in case the boss spawns below full health).
      Overrides:
      create in class Component
    • update

      public void update()
      Called once per frame. Checks current health ratio and applies phase changes when thresholds are crossed.
      Overrides:
      update in class Component