logo
By Lawrence

5 minutes

Build a Ship from a Named Loadout

Last lesson you proved the collision works by hand-typing two throwaway boxes in local space and tuning their half-extents until a tracer finally stopped. But those were two non-critical boxes. A real fighter has a cockpit, two wings, engines, and a fuselage, each with its own HP and a flag for whether losing it kills the ship. Nobody wants to type that table by hand, and you would need one per enemy — and scene JSON can't import a TypeScript PartDef[], so there is no way to hand a ship an array from a file. You want to write one word, like "this is a kilrathi fighter," and get the whole hitbox table for free.

Name a loadout instead of typing boxes

Two edits. On Player, add one line:

"ShipLoadout": { "loadout": "spaceplane" }

On Enemy1, delete the inline Parts and SpaceShooterHealth blocks you typed last lesson. Delete all of it. Then replace the pair with a single line:

"ShipLoadout": { "loadout": "kilrathi" }

Neither ship declares Parts or SpaceShooterHealth in JSON anymore. Each one names a loadout. The parts and the health bar appear at runtime.

Continue reading

Unlock the Full Course

Every lesson, the runnable examples, and the finished build — yours to keep.

$9one-time

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search