Members
CHAOS_CLASSNAME :string
Type:
- string
- Source:
CHAOS_OBJ_TYPE :string
Type:
- string
- Source:
active :boolean
A flag to show if the entity is added to a manager.
Type:
- boolean
- Source:
manager
Gets the current manager of an entity
- Source:
Methods
addTag(n)
Adds a tag into an entity.
Parameters:
Name | Type | Description |
---|---|---|
n |
string | The tag to be added |
- Source:
attach(n, c) → {this}
Adds a component into an entity
Parameters:
Name | Type | Description |
---|---|---|
n |
String | Name of the component. |
c |
Component | The component to add. |
- Source:
Returns:
- Type
- this
destroy()
Removes all components and handlers from an entity while removing it from its manager
- Source:
fromJSON(obj, compList)
Todo - type serialization docs correctly
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | |
compList |
Map.<string, function()> |
- Source:
get(n) → {Component|undefined}
Returns the named component.
Parameters:
Name | Type | Description |
---|---|---|
n |
string | Name of the component. |
- Source:
Returns:
- Type
- Component | undefined
getHandler(n) → {function|undefined}
Returns an event handler which can be fired during an event
Parameters:
Name | Type | Description |
---|---|---|
n |
string | Name of the event |
- Source:
Returns:
- Type
- function | undefined
has(n) → {boolean}
Used to check if the component exists in an entity
Parameters:
Name | Type | Description |
---|---|---|
n |
string | Name of the component. |
- Source:
Returns:
- Type
- boolean
hasTag(n) → {boolean}
Checks if a tag exists in an entity.
Parameters:
Name | Type | Description |
---|---|---|
n |
string | The tag to be added |
- Source:
Returns:
- Type
- boolean
(package) init(global)
Initializes the components within an entity and marks it as active.
It is called by an instance of a game manager so no need to call it manually
Parameters:
Name | Type | Description |
---|---|---|
global |
Manager |
- Source:
query(bound, targetopt) → {Array.<Entity>}
Search an entity's manager for entities in a given bound.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
bound |
Bounds | the region to search entitities in. | ||
target |
Array.<Entity> |
<optional> |
[] | An array to store results in. |
- Source:
Returns:
- Type
- Array.<Entity>
register(n, h)
Registers a function to handle a named event.
Parameters:
Name | Type | Description |
---|---|---|
n |
string | Name of the event |
h |
function | The function to be called when an event is fired. |
- Source:
remove(n)
Removes a component from an entity.
Parameters:
Name | Type | Description |
---|---|---|
n |
String | Name pf the component |
- Source:
removeComponents()
Removes all components of an entity from its manager but keeps the entity inside the manager.
This is an internal function so no need on your part to use it.
- Source:
removeSelf()
Removes an entity and its components from its manager whilst retaining its components and handlers
- Source:
removeTag(n)
Removes a tag from an entity.
Parameters:
Name | Type | Description |
---|---|---|
n |
string | The tag to be added |
- Source:
(package) reset()
This is an internal function,no need to use it.
- Source:
unregister(n)
Removes an event handler function of the given name
Parameters:
Name | Type | Description |
---|---|---|
n |
string | Name of the event |
- Source:
(static) Default(x, y, a) → {Entity}
A helper function to create a new Entity with transform,movable and bounds components.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | |
y |
number | |
a |
number |
- Source:
Returns:
- Type
- Entity