Entity object of the game engine.
Name | Type | Description |
---|---|---|
game |
Core.Game | the game object |
name |
String | the name of the entity |
alive |
Boolean | is the entity enabled or disabled? |
x |
Number | the x coordinate |
y |
Number | the y coordinate |
automated |
Boolean | should the entity be automated (in update, render, etc) |
Members
-
should automate physics
-
should automate rendering
-
should automate update
-
children dictionary
-
game Core.Game
-
the engine instance that created it
-
name
-
transform Core.Transform
-
transform
Methods
-
adds child to entity
Name Type Description name
String child name child
object child, can be of any type; if present setParent() is called. -
adds component to entity
Name Type Description comp
Type type/constructor to add as component. -
clears current parent of entity (set to null)
-
delete a child by name
Name Type Description childName
String the child name Returns:
Type Description Boolean true if succeeded; false otherwise -
delete component
Name Type Description componentName
String the component name Returns:
Type Description Boolean true if succeeded; false otherwise -
deletes component of type
Name Type Description componentType
Type the component type Returns:
Type Description Boolean true if succeeded; false otherwise -
prepares entity components for deletion
-
ends rendering the entity (restores transform to graphical context)
-
gets built-in component by simplified name.
Name Type Description compName
String built-in component's simplified name (usually type in lowercases) Returns:
Type Description object built-in component if found; null otherwise. -
gets child by name (recursively)
Name Type Description name
String child name to check for Returns:
Type Description object the child if found; null otherwise. -
gets child by index
Name Type Description i
Number the child index Returns:
Type Description object the child if found; null otherwise. -
generates child name (serial indexing)
Returns:
Type Description String generated child name -
gets component from name
Name Type Description compName
String component name to search for. Returns:
Type Description object the component if found; null otherwise. -
gets component by type
Name Type Description type
Type the component's type (constructor name) Returns:
Type Description object the component if found; null otherwise. -
getDimentions ()Utils.Vector2d
-
gets default dimentions (encapsulating children)
Returns:
Type Description Utils.Vector2d default width height 2d vector. -
gets array of entity children
Returns:
Type Description Array the entity children of this entity -
getGlobalTransform ()Utils.Vector2d
-
gets global (recursive/world) transform.
Returns:
Type Description Utils.Vector2d the global transform. -
checks whether a component of type is attached
Name Type Description type
Type component type to search for Returns:
Type Description Boolean true if component of type is attached; false otherwise. -
checks whether entity has child with certain name.
Name Type Description name
String child name to check Returns:
Type Description Boolean true if has, false otherwise -
adds child with generated name
Name Type Description c
object the child object to add. -
renders the entity (and it's children)
-
force dimentions
Name Type Description w
Number width h
Number height -
sets parent of current entity (make sure it's actually a child!)
Name Type Description entity
Core.Entity parent entity -
starts rendering the entity (applies transform to the graphical context)
-
updates the entity and it's children