Skip to content
Adrian Papari edited this page Feb 21, 2017 · 7 revisions

Archetypes

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

Creating

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

Using

int chicken = world.create(chickenArchetype);

Extending

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