Skip to content
DaanVanYperen edited this page Sep 20, 2014 · 7 revisions

Archetypes

Archetypes provide a reusable blueprint for new entities. Archetypes have a performance benefit.

Work in progress. Support pre- and post creation parameterized components, serialization and archetype composition planned for future versions. See ticket #104 for further discussion.

Creating

Archetype chickenArchetype = 
         new ArchetypeBuilder()
         .add(Pos.class)
         .add(Anim.class)
         .add(Bounds.class)
         .build(world);

Using

Entity chicken = world.createEntity(chickenArchetype);

Extending

Archetype flamingChickenArchetype = 
          new ArchetypeBuilder(chickenArchetype)
          .add(Flaming.class)
          .build(world);
Clone this wiki locally