Skip to content
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. (odb injects 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) - entity matches composition (created or altered).
  • removed(int e) - entity lost composition (deleted or altered).
Clone this wiki locally