A group of entities which can be added to or removed from the Scene and moved together. Also supports object pooling.
Available since:
2.6.0
Constructor
Variables
read only count : Int
entities : Array<T>
Functions
add (entity : T, index : Int = -1) : T
Add an Entity to this EntityList and its Scene.
Parameters:
| entity | The Entity to be added. | |
| index | Position to insert the Entity, default last. |
Returns:
The Entity.
create (cls : Class<T>, constructorArgs : Array<Dynamic>) : T
Returns a new Entity, or a stored recycled Entity if one exists.
Parameters:
| addToScene | Add it to the Scene immediately. | |
| constructorArgs | List of the entity constructor arguments (optional). |
Returns:
The new Entity object.
map<R> (f : T ->R, ) : Array<R>
Call a function on all Entities in an EntityList and return its value.
recycle (entity : T) : T
Removes the Entity from the EntityList at the end of the frame and recycles it. The recycled Entity can then be fetched again by calling the create() function.
Parameters:
| e | The Entity to recycle. |
Returns:
The recycled Entity.
remove (entity : T) : T
Remove an Entity from this EntityList and its Scene.
Parameters:
| entity | The Entity to be removed. |
Returns:
The Entity.