class Crash::Entity
- Crash::Entity
- Reference
- Object
Included Modules
- EventHandler
Defined in:
crash/entity.crConstructors
Instance Method Summary
-
#add(component : Crash::Component, component_class : Crash::Component.class)
Add a component to the entity.
- #add(component : Crash::Component)
-
#get(component_class : Crash::Component.class) : Crash::Component | Nil
Get a component from the entity.
-
#get_all
Get all components from the entity.
-
#has(component_class : Crash::Component.class) : Bool
Does the entity have a component of a particular type.
- #name : String
- #name=(name : String)
- #remove(component_class : Crash::Component.class)
Constructor Detail
Instance Method Detail
Add a component to the entity.
@param component The component object to add. @param componentClass The class of the component. This is only necessary if the component extends another component class and you want the framework to treat the component as of the base class type. If not set, the class type is determined directly from the component.
@return A reference to the entity. This enables the chaining of calls to add, to make creating and configuring entities cleaner. e.g.
var entity : Entity = new Entity()
.add( new Position( 100, 200 )
.add( new Display( new PlayerClip() );
Get a component from the entity.
Does the entity have a component of a particular type.
@param componentClass The class of the component sought. @return true if the entity has a component of the type, false if not.