Entities
An entity itself is not that special, it is just a container for components. It also has position
, scale
, rotation
, and z
attributes which can be used by e.g. rendering. Components can be inserted upon instantiation or via the <<
method.
The Entity
class defines some convenience functions such as the has
method to check wether it contains one ore more kinds of components and the []
and []?
methods for component access via type. One can also get the id or get and set the array of components.
Any entity can be flagged as dead by calling Entity#suicide
. The flag state can be checked via the Entity#alive?
getter.
You can find an example in the components section.
Last updated