Build an Entity Cloner

Prototype pattern

Challenge 5 of Create & Share ObjectsIntermediate~55 minFree

Learn the Prototype design pattern by cloning game entities from a registry of prototypes. Build deep-copy cloning, a prototype registry, override-aware spawning, and unique id stamping from an injected counter.

5 steps

  1. 1Clone an Entity
  2. 2Deep independence
  3. 3A prototype registry
  4. 4Spawn with overrides
  5. 5Fresh ids from an injected counter
Start step 1