Skip to content

Entities

Mark Knol edited this page Jan 17, 2018 · 4 revisions

The entity is a general purpose object

You can nest Entities inside an Entity (addChild-function) but you can also add Components (using the add-function). You cannot extend a Entity. The Entities define the hierarchy and order of the 'displaylist'/rendering order.

In Flambe, every entity has these important functions:

  • addChild(entity:Entity) Adds a child Entity (to nest entities)
  • removeChild(entity:Entity) Remove a child Entity
  • add(component:Component) Add a component to this entity. Any previous component of this type will be replaced.
  • remove(component:Component) Remove a component from this entity.
  • get(componentClass:Class) Gets a component of a given type from this entity.
  • getComponent(name:String) Gets a component by name from this entity.
  • has(componentClass:Class) Checks if this entity has a component of the given type.
  • disposeChildren() Dispose all of this entity's children, without touching its own components or removing itself from its parent.
  • dispose() Removes this entity from its parent, and disposes all its components and children.

Entity API Docs

Clone this wiki locally