Entity Class
The entity class. Cannot be instantiated outside the framework, you must create new entities using World.
Item Index
Methods
Properties
Methods
addComponent
-
component
-
[type]
Add a component to this entity.
Parameters:
-
component
Component -
[type]
ComponentType optional
addToWorld
()
Refresh all changes to components for this entity. After adding or removing components, you must call this method. It will update all relevant systems. It is typical to call this after adding components to a newly created entity.
changedInWorld
()
This entity has changed, a component added or deleted.
deleteFromWorl
()
Delete this entity from the world.
disable
()
Disable the entity from being processed. Won't delete it, it will continue to exist but won't get processed.
enable
()
(Re)enable the entity in the world, after it having being disabled. Won't do anything unless it was already disabled.
getComponent
-
[type]
This is the preferred method to use when retrieving a component from a entity. It will provide good performance. But the recommended way to retrieve components from an entity is using the ComponentMapper.
Parameters:
-
[type]
ComponentType optionalin order to retrieve the component fast you must provide a ComponentType instance for the expected component.
Returns:
getComponentBits
()
Utils.BitSet
Returns a BitSet instance containing bits of the components the entity possesses.
Returns:
getComponents
-
fillBag
Returns a bag of all components this entity has. You need to reset the bag yourself if you intend to fill it more than once.
Parameters:
-
fillBag
Utils.Bagthe bag to put the components into.
Returns:
getId
()
Number
The internal id for this entity within the framework. No other entity will have the same ID, but ID's are however reused so another entity may acquire this ID if the previous entity was deleted.
Returns:
getSystemBits
()
Utils.BitSet
Returns a BitSet instance containing bits of the components the entity possesses.
Returns:
getUuid
()
String
Get the UUID for this entity. This UUID is unique per entity (re-used entities get a new UUID).
Returns:
getWorld
()
ArtemiJS.World
Returns the world this entity belongs to.
Returns:
isActive
()
Boolean
Checks if the entity has been added to the world and has not been deleted from it. If the entity has been disabled this will still return true.
Returns:
isEnabled
()
Boolean
Returns:
removeComponent
-
[component]
Remove component by its type.
Parameters:
-
[component]
Component optional
reset
()
private
Get systems BitSet
toString
()
String
Make entity ready for re-use. Will generate a new uuid for the entity.