Entity

An entity is composed of components. As such, it is essentially a collection object for components. Sometimes, the entities in a game will mirror the actual characters and objects in the game, but this is not necessary.

<p>Components are simple value objects that contain data relevant to the entity. Entities with similar functionality will have instances of the same components. So we might have a position component</p>

<p><code>public class PositionComponent { public var x : Number; public var y : Number; }</code></p>

<p>All entities that have a position in the game world, will have an instance of the position component. Systems operate on entities based on the components they have.</p>

Constructors

this
this(string name)

The constructor

Members

Functions

add
Entity add(T component)

Add a component to the entity.

add
Entity add(Object component, ClassInfo class_info)
Undocumented in source. Be warned that the author may not have intended to support it.
get
T get()

Get a component from the entity.

get
Object get(ClassInfo class_a)

Get a component from the entity.

getAll
Object[] getAll()

Get all components from the entity.

has
bool has()

Does the entity have a component of a particular type.

has
bool has(ClassInfo class_a)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
Object remove()

Remove a component from the entity.

remove
Object remove(ClassInfo class_a)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

componentAdded
mixin Signal!(Entity, ClassInfo) componentAdded

This signal is dispatched when a component is added to the entity.

componentRemoved
mixin Signal!(Entity, ClassInfo) componentRemoved

This signal is dispatched when a component is removed from the entity.

nameChanged
mixin Signal!(Entity, string) nameChanged

Dispatched when the name of the entity changes. Used internally by the engine to track entities based on their names.

Properties

name
string name [@property getter]

All entities have a name. If no name is set, a default name is used. Names are used to fetch specific entities from the engine, and can also help to identify an entity when debugging.

name
string name [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
next
Entity next [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
next
Entity next [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
previous
Entity previous [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
previous
Entity previous [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Meta