From 227e9bb882ee7f4ed8dd6535b2d813bee0db8f79 Mon Sep 17 00:00:00 2001 From: ~keith Date: Wed, 23 Feb 2022 23:42:32 +0000 Subject: [PATCH] Update 'Scene Actor Component model' --- Scene-Actor-Component-model.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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)