Skip to content
Daan van Yperen edited this page Aug 11, 2015 · 50 revisions

Entities are distinct containers of related components.

Creating

 Entity myEntity = new EntityBuilder(world)
     .with(new Pos(10,10), new Anim("Chicken"))
     .tag("boss")
     .group("enemies")
     .build();

Or

  • Archetype - Fastest, low level, no parameterized components.
  • Entity Factory - Fast, clean and convenient. For fixed composition entities. Requires some setup.
  • Edit created entity - Fast, bit verbose. see below.

Editing

classes

  EntityEdit chickenEdit = entity.edit();
  Flaming flaming = chickenEdit.create(Flaming.class);
  flaming.strength = 500;
  chickenEdit.remove(Freezing.class);

Entity Transmuters allow for high performance edits.

instances

entity.edit().add(new Flaming(500))

Discouraged for games that may require pooling or packing!

Clone this wiki locally