Component
A pure data container attached to a single Entity.
Require
Section titled “Require”If the concord folder is in the root directory of your game, you can import this module like so:
concord.component = require('concord.component')Component
Section titled “Component”Component instances are created when an Entity :gives the class; populate runs at attach time.
Methods
Section titled “Methods”| Method | Description |
|---|---|
| Component.new | Creates a new ComponentClass and registers it by name. |
| Component:hasName | Returns true if the Component has a name. |
| Component:getName | Returns the name of the Component. |
| Component:removed | Callback for when the Component is removed or replaced in an Entity. |
| Component:serialize | Callback for when the Component is serialized as part of an Entity. |
| Component:deserialize | Callback for when the Component is deserialized from serialized data. |
| Type | Description |
|---|---|
| ComponentClass | Registered component type returned by Component.new / Component(). |