Constructor
(private) new Entity(name)
Do not instantiate this class directly, use the Engine.entity() method.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Entity name |
Extends
- EventEmitter
Methods
deleteComponent(componentName)
Remove a component association
Parameters:
Name | Type | Description |
---|---|---|
componentName |
String |
destroy()
Remove this entity from the engine
getComponent(componentName)
Retrieve a component by name
Parameters:
Name | Type | Description |
---|---|---|
componentName |
String | The component name |
getName() → {String}
Returns this entity name
Returns:
this entity name
- Type
- String
hasComponent(componentName) → {Boolean}
Check if the entity is associated to a component
Parameters:
Name | Type | Description |
---|---|---|
componentName |
String | Name of the component |
Returns:
true if the entity has the component associated, false otherwise.
- Type
- Boolean
setComponent(componentName, componentData)
Associate the entity to a component. The component can be any type.
Parameters:
Name | Type | Description |
---|---|---|
componentName |
String | The component name |
componentData |
* | The component data |