Update 'Scene Actor Component model'
parent
21e20033d0
commit
227e9bb882
1 changed files with 12 additions and 1 deletions
|
@ -8,10 +8,21 @@ In general, scenes (and the actors within them) *should not* reference other sce
|
||||||
# Actors
|
# Actors
|
||||||
Actors represent the game entities within a scene. They have a transform (location, rotation, and scale), may be a child of another actor, and contain a set of components which define their behaviour. They also store a set of tags, which can be used to classify and filter for specific types of objects (e.g. terrain, enemies, players, UI).
|
Actors represent the game entities within a scene. They have a transform (location, rotation, and scale), may be a child of another actor, and contain a set of components which define their behaviour. They also store a set of tags, which can be used to classify and filter for specific types of objects (e.g. terrain, enemies, players, UI).
|
||||||
|
|
||||||
|
Newly created actors should be initialized using the `(initialize-actors-in)` function, like so:
|
||||||
|
|
||||||
|
```common-lisp
|
||||||
|
(initialize-actors-in my-scene
|
||||||
|
(new! actor :name "Example"
|
||||||
|
:component (new! sprite :texture my-texture)
|
||||||
|
(new! actor :name "Another example"
|
||||||
|
:location (vec2 4.20 -6.9)
|
||||||
|
:component (new! sprite :texture another-texture))
|
||||||
|
```
|
||||||
|
|
||||||
# Components
|
# Components
|
||||||
Components define a group of behaviours and properties for the actor they're attached to. They can interact with other components and actors.
|
Components define a group of behaviours and properties for the actor they're attached to. They can interact with other components and actors.
|
||||||
|
|
||||||
If a component needs to automatically establish a reference to another component or actor, it should do this during late-stage initialization, eg. in `[component (activate)]`. Otherwise, the other object may not have been instantiated yet.
|
If a component needs to automatically establish a reference to another component or actor, it should do this during late-stage initialization, eg. in `(activate)`. Otherwise, the other object may not have been instantiated yet.
|
||||||
|
|
||||||
## Lifecycle
|
## Lifecycle
|
||||||
![Component lifecycle diagram](https://bytes.keithhacks.cyou/keith/wh-engine/raw/branch/master/doc/component-lifecycle.svg)
|
![Component lifecycle diagram](https://bytes.keithhacks.cyou/keith/wh-engine/raw/branch/master/doc/component-lifecycle.svg)
|
||||||
|
|
Loading…
Reference in a new issue