1
\$\begingroup\$

In artemis framework how can I list all entities wtih a given type of component and delete them from the world? I couldn't find any examples in the documentation and it seems there's no straightforward way of doing this

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Here's an example system that deletes all entities with the "Expires" component:

public class DeleteEntitiesSystem extends EntitySystem {

    public DeleteEntitiesSystem() {
        super(Aspect.getAspectForAll(Expires.class));
    }

    @Override
    protected void processEntities(Array<Entity> entities) {
        for (Entity e : entities) {
            e.deleteFromWorld();
        }
    }
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .