Entity: The entity is a general-purpose object. It only consists of a unique ID. They "tag every coarse game object as a separate item". Example:
Entity.create id world
|> Entity.with ( positionSpec, positionComponent )
|> Entity.with ( velocitySpec, velocityComponent )
Basics.Int
create : EntityID -> world -> ( EntityID, world )
Start point for spawning Entity
Entity.create id world
|> Entity.with ( positionSpec, positionComponent )
|> Entity.with ( velocitySpec, velocityComponent )
with : ( Logic.Component.Spec comp world, comp ) -> ( EntityID, world ) -> ( EntityID, world )
Set component to spawn with a new entity
Entity.create ( id, world )
|> Entity.with ( positionSpec, positionComponent )
|> Entity.with ( velocitySpec, velocityComponent )
remove : Logic.Component.Spec comp world -> ( EntityID, world ) -> ( EntityID, world )
Way to create Entity
destruction functions, should pipe in all possible component specs.
It also can be used to just disable (remove) some components from an entity.
remove =
Entity.remove positionSpec
>> Entity.remove velocitySpec
newWorld =
remove ( id, world )