abstract class Scar::Object
- Scar::Object
- Scar::Entity
- SF::Transformable
- Reference
- Object
Overview
Base class for OOP based Entities
An object has the same methods as a system: #init, #update and #render,
so all the behaviour and data can be in the same place.
You can still add components like with a normal entity though.
You do not need to implement the #render method to draw something, you can also just use regular
drawable components or include Scar::Drawable (see Drawable documentation).
Direct Known Subclasses
Defined in:
scar/object.crInstance Method Summary
- 
        #init(app : App, space : Space)
        
          For initialization (called once when this object is added to a space) 
- #initialized : Bool
- #initialized=(initialized : Bool)
- 
        #render(app : App, space : Space, dt)
        
          For drawing logic (called on every frame after #update)
- 
        #update(app : App, space : Space, dt)
        
          For update logic (called on every frame) 
Instance methods inherited from class Scar::Entity
  
  
    
      <<(c : Component)<<(*cs : Component) <<, [](comp_type : T.class) : T forall T [], []?(comp_type : T.class) : T | Nil forall T []?, alive? : Bool alive?, components : Array(Scar::Component) components, components=(components : Array(Scar::Component)) components=, destroy destroy, has?(c : Component.class) : Bool
has?(cs : Array(Component.class)) : Bool
has?(*cs : Component.class) : Bool has?, id : String id, z : Int32 z, z=(z : Int32) z=
Constructor methods inherited from class Scar::Entity
  
  
    
      new(id : String, components : Array(Component), *, position : Vec | Nil = nil, scale : Vec | Nil = nil, rotation : Float32 | Nil = nil, z : Int32 = 0)new(id : String, *comps : Component, position : Vec | Nil = nil, scale : Vec | Nil = nil, rotation : Float32 | Nil = nil, z : Int32 = 0)
new(id : String, *, position : Vec | Nil = nil, scale : Vec | Nil = nil, rotation : Float32 | Nil = nil, z : Int32 = 0) new
Instance Method Detail
For initialization (called once when this object is added to a space)
For drawing logic (called on every frame after #update)