- Psykick2D
Entity
A collection of components which make up an object in the world
new Entity(
id
)
Parameters
id | number | Unique ID assigned by the World |
Properties
id | number |
Methods
addComponent( )
Add a new component to the Entity
component | object |
addComponentAs( )
Adds a component marked as a given type
This can be used to use one component for multiple things i.e. physics body and a rectangle
component | object | ||
componentType | string | Type to mark it as |
removeComponent( )
Removes a component from the Entity
component | object |
getComponent( )
Returns the component with the matching name
componentName | string |
boolean hasComponent( )
Determine if an Entity has a given component type
componentName | string |