-
Notifications
You must be signed in to change notification settings - Fork 117
Entity
Adrian Papari edited this page Feb 3, 2015
·
50 revisions
In artemis-odb, an Entity wraps a set of related components, and provides helper methods for component and entity management.
You cannot customize entities directly, extend the functionality by means of custom components.
Entity myEntity = new EntityBuilder(world)
.with(new Pos(10,10), new Anim("Chicken"))
.tag("boss")
.group("enemies")
.build();
alternatively:
- use EntityFactory - Fast, clean and convenient. For fixed composition entities. Requires some setup.
- use Archetype - Fastest, low level, no support for parameterized components.
- Call
world.createEntity().edit()
Flaming flaming = entity.edit().create(Flaming.class);
flaming.strength = 500;
User managed components are possible but discouraged: entity.edit().add(new Flaming(500))
entity.edit().remove(Flaming.class);
Fastest way of changing entity component compositions. Primarily useful when bootstrapping entities over several different managers/systems or when dealing with many entities at the same time (lightweight particle systems etc).
// initialize to a field
this.transmuter = new EntityTransmuterFactory(world)
.add(Sprite.class)
.add(Renderable.class)
.remove(AssetReference.class)
.build();
// apply transformation to entity
this.transmuter.transmute(entity)
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference