How to define and register a component
Position
component may contain the x
, y
, and z
coordinates of an entity.Health
component may contain the current
and max
health of an entity.component
directory in its own separate files.
You can easily create a new component and register it to the world by following these steps:
Define the component struct
Name()
method which returns a unique name of the component. This is used to identify the component in the world.Register the component in main.go
RegisterComponent
function.