Class: Entity

Entity

Entity represents a node in the Scene graph that can have Component objects added to it, which can define its behavior in a modular way.


new Entity()

Author:
  • derschmale <http://www.derschmale.com>

Methods


addComponent()

Adds a single Component object to the Entity.


addComponents(components)

Adds multiple Component objects to the Entity.

Parameters:
Name Type Description
components Array

An array of components to add.


destroy()


getComponentsByType()

Returns an array of all Components with a given type.


hasComponentType()

Returns whether or not the Entity has a component of a given type assigned to it.


removeComponent()

Removes a single Component from the Entity.


removeComponents(components)

Removes multiple Component objects from the Entity.

Parameters:
Name Type Description
components Array

A list of components to remove.