diff --git a/Scene-Actor-Component-model.md b/Scene-Actor-Component-model.md index 9ce6687..82a98f2 100644 --- a/Scene-Actor-Component-model.md +++ b/Scene-Actor-Component-model.md @@ -8,10 +8,21 @@ In general, scenes (and the actors within them) *should not* reference other sce # 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). +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 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 ![Component lifecycle diagram](https://bytes.keithhacks.cyou/keith/wh-engine/raw/branch/master/doc/component-lifecycle.svg)