-
Notifications
You must be signed in to change notification settings - Fork 114
IteratingSystem
Daan van Yperen edited this page Sep 29, 2015
·
5 revisions
Processes all entities matching an Aspect iteratively when World ticks.
public class CookieBakingSystem extends IteratingSystem {
ComponentMapper<Baked> mBaked; // injected automatically.
public CookieBakingSystem() {
super(Aspect.all(Cookie.class).exclude(Baked.class));
// match all unbaked cookies.
}
/* called for each matching entity. */
@Override
protected void process(int e) {
mBaked.create(e); // bake cookie! (adds Bake component if missing)
}
}
Override the following methods in your EntityProcessingSystem to integrate your game logic.
-
initialize()
- Manually initialize. (odb injects what you need, see @Wire!) -
begin()
- Called before the entities are processed.
-
process(int e)
- Called for every Aspect matching entity.
-
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).
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference