Hitbox Boss

Scene: DuckShooter_HitboxBoss

A more complex health setup: one boss duck whose single Health is fed by many hitboxes, each affecting it differently.

  flowchart LR
    W["Weak sphere x2"] --> H((Boss Health))
    N["Normal sphere x1"] --> H
    A["Armored sphere x0.5"] --> H

Where you hit decides how fast the boss goes down: a weak sphere takes four times the damage of an armored one.

🦆 The Boss: DS_BossDuck Variant

The boss is a prefab variant of DS_Duck, so it keeps the duck’s setup and adds to it:

PartSetup
Health5000 on the root
Health barOn Health Changed sets a UI slider’s value
HitpointShows the damage from the health’s On Damage Data Received, whichever sphere was hit
8 spheresEach has a Hitbox with a multiplier of 2, 1 or 0.5

Every sphere’s hitbox finds the same Health on the boss’s root, so they all damage one health pool.

⚪ The Spheres

Each sphere has one solid collider that both takes and deals damage:

  • A Hitbox: your bullets hurt the boss.
  • A Health Pickup with Amount -1000, Collectors set to the player and Destroy On Collect off: flying into a sphere destroys your ship, every time.
  • A non-kinematic Rigidbody without gravity and with every axis frozen. The ship’s Rigidbody is kinematic, so the sphere needs its own to get collision events.

Note

The pickup hurts through Health.Hurt, so the ship’s spawn Invincibility still protects it.

Tip

Use the same setup for headshots on characters: one Health on the root and a hitbox per body part with its own multiplier.