-
Notifications
You must be signed in to change notification settings - Fork 109
BaseEntitySystem
Daan van Yperen edited this page Sep 29, 2015
·
4 revisions
BaseEntitySystem tracks a subset of entities, but does not implement any sorting or iteration.
public class MySystem extends BaseEntitySystem {
public MySystem() {
super(Aspect.all()); // match all entities.
}
@Override
protected final void processSystem() {
IntBag actives = subscription.getEntities();
int[] ids = actives.getData();
for (int i = 0, s = actives.size(); s > i; i++) {
// my custom iteration.
}
}
}
Execution flow
Upon calling world.process()
, your systems are processed in sequence. Override the following methods to integrate your game logic.
initialize()
- Manually initialize your system. (odb injects most of what you need, see @Wire!)
begin()
- Called before the entities are processed.
processSystem()
- Called once per cycle.
end()
- Called after the entities have been processed.
inserted(int e)
- Matching entity has been created (or the matching components added).
removed(int e)
- Matching entity has been deleted (or the matching components removed).
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference