Class Index | File Index

Classes


Class entity

entity
Defined in: entity.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
entity()
extensible behavior object updated by the engine.
Field Summary
Field Attributes Field Name and Description
 
The global X position of this entity that considers all parents of this entity.
 
The global Y position of this entity that considers all parents of this entity.
 
The global Z position of this entity that considers all parents of this entity.
 
id
The entity's unique ID.
 
Returns wether or not the Engine is handling calling Draw() automatically, taking into account the Entity's hierarchy.
 
Returns wether or not the engine is handling calling step() automatically, taking into account the Entity's hierarchy.
 
The name identifier of the entity.
 
The Node of the Entity, holding info such as the position and rotation.
Method Summary
Method Attributes Method Name and Description
 
Creates a new component as part of this entity.
 
attach(child)
Adds the given entity as a child.
 
contains(queriedEntity)
Returns whether the given entity is contained within this entity.
 
Convenienve function to create a new entity that is set as a child of this entity.
 
Removes the child-parent relationship, detaching this entity from its parent.
 
draw()
Performs the normal draw iteration, which calls onDraw() for this entity, draw() for all children entities, and draw() for all attached components.
 
Returns the last recorded amount of milliseconds it took the Entity, iedentified by id, to complete its draw cycle.
 
Returns all bound entities with the name equivalent to the one given within this entity's hierarchy.
 
Returns all Entities that are within this Entity's hierarchy.
 
Returns the i'th Entity starting at 0.
 
Returns all components that belong to the Entity.
 
Returns the number of children belonging to this entity.
 
Returns the parent of the entity.
 
Returns the priority of the this entity.
 
Returns whether this entity has a parent.
 
Returns whether or not there is currently an attached component of the tag given if it exists.
 
Detaches and marks this entity for deletion.
 
Removes the first occurrance of a component with the tag given.
 
Alters the priority of this entity.
 
Sends the entity to be drawn and updated as the last in the queue causing it to be on top when drawing.
 
Sends the entity of the ID to be the last of in line for drawing and updates.
 
step()
Performs the normal draw iteration, which calls onStep() for this entity, step() for all children entities, and step() for all attached components.
 
Returns the last recorded amount of milliseconds it took the Entity, iedentified by id, to complete its step cycle.
 
Returns whether the entity has been removed from sandboxe.
Class Detail
entity()
extensible behavior object updated by the engine. Created with sandboxe.entity.create

Entities are the base object that provides means to easily include custom update behavior. Along with calling custom step and draw functions over time, with components you can provide a more manageable software platform fior youtr project.

Entities are arranged in a hierarchical fashion, where the root is assigned using sandboxe.engine.setRoot
Field Detail
globalX
The global X position of this entity that considers all parents of this entity.

globalY
The global Y position of this entity that considers all parents of this entity.

globalZ
The global Z position of this entity that considers all parents of this entity.

id
The entity's unique ID. The ID uniquely identifies an entity.

isDrawing
Returns wether or not the Engine is handling calling Draw() automatically, taking into account the Entity's hierarchy.

isStepping
Returns wether or not the engine is handling calling step() automatically, taking into account the Entity's hierarchy.

name
The name identifier of the entity. The name is settable only the first time it is set. Afterward, any further setting will have no effect.

node
The Node of the Entity, holding info such as the position and rotation.
Method Detail
{component} addComponent(type)
Creates a new component as part of this entity.
Parameters:
{Number} type
The component type to use. See sandboxe.component.type
Returns:
{component} The component created.

attach(child)
Adds the given entity as a child. When a child, an Entity will be updated when the World is updated.
Parameters:
{entity} child

{Boolean} contains(queriedEntity)
Returns whether the given entity is contained within this entity.
Parameters:
{entity} queriedEntity
Returns:
{Boolean}

{entity} createChild()
Convenienve function to create a new entity that is set as a child of this entity.
Returns:
{entity}

detach()
Removes the child-parent relationship, detaching this entity from its parent.

draw()
Performs the normal draw iteration, which calls onDraw() for this entity, draw() for all children entities, and draw() for all attached components.

{Number} drawDuration()
Returns the last recorded amount of milliseconds it took the Entity, iedentified by id, to complete its draw cycle. A draw cycle consists of the Entities Draw function and any attached components' draw.
Returns:
{Number}

{Array} findChildByName()
Returns all bound entities with the name equivalent to the one given within this entity's hierarchy.
Returns:
{Array} searchResults

{Array} getAllSubEntities()
Returns all Entities that are within this Entity's hierarchy.
Returns:
{Array} allSubEntities

{Array} getChildren()
Returns the i'th Entity starting at 0. Entities are ordered by priority, where the first entity is guaranteed to be the one with the lowest Priority value.
Returns:
{Array} children

{Array} getComponents()
Returns all components that belong to the Entity.
Returns:
{Array} array of all components

{Number} getNumChildren()
Returns the number of children belonging to this entity.
Returns:
{Number}

{entity} getParent()
Returns the parent of the entity.
Returns:
{entity}

{Number} getPriority()
Returns the priority of the this entity.
Returns:
{Number} priority value

{Boolean} hasParent()
Returns whether this entity has a parent.
Returns:
{Boolean}

{component} queryComponent()
Returns whether or not there is currently an attached component of the tag given if it exists. If there a multiple, the earliest component added is returned.
Returns:
{component}

remove()
Detaches and marks this entity for deletion.

removeComponent(tag)
Removes the first occurrance of a component with the tag given.
Parameters:
{String} tag
The tag that identifies the component to remove.

setPriority(p)
Alters the priority of this entity. Priorty determines the order in which this entity is updated. A lower priority means it will be drawn and updated earlier. It is undefined which entity is updated first if both have the same priority.
Parameters:
{Number} p
The new priority.

setPriorityFirst()
Sends the entity to be drawn and updated as the last in the queue causing it to be on top when drawing.

setPriorityLast()
Sends the entity of the ID to be the last of in line for drawing and updates.

step()
Performs the normal draw iteration, which calls onStep() for this entity, step() for all children entities, and step() for all attached components.

{Number} stepDuration()
Returns the last recorded amount of milliseconds it took the Entity, iedentified by id, to complete its step cycle. A step cycle consists of the Entities Step function and any attached components' step.
Returns:
{Number}

{Boolean} valid()
Returns whether the entity has been removed from sandboxe. It will still be accessible, but not usable.
Returns:
{Boolean} Whether this entity is still valid.

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Feb 03 2019 18:30:56 GMT-0500 (EST)