{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorAnchorElement** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorAnchorElement ====== Behavior element behavior adding anchor element support. Anchoring elements allows to locate elements in a GameWorld using a unique name set by the mapper. This is useful for game commands send by conversations scripts. ====== Instance Counts ====== This behavior can be used only once on an element. ====== Element Class Properties ====== Element class properties have no prefix. ===== anchorID ===== Sets the anchor name or empty string to not anchor. * Full name: "anchorID" * Type: string * Default Value: empty string * Example (*.deeclass) Important Prop ====== Events ====== This behavior has no events ====== Required Behaviors ====== This behavior requires no other behaviors. ====== Optional Behaviors ====== This behavior does not support optional behaviors. ====== Persistency ====== This behavior does not require persistency. ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorAnchorElement.html,ECBehaviorAnchorElement~@#. Since DragonScript Module Version **1.0** ====== Use Cases ====== * Reference elements in world editor using unique the anchor name. * Allow game scripts to locate an element in the game world using the anchor name. ====== Element Class Example ====== This example defines an element for which the user can set the anchor name in the world editor. He can then locate the element in the parent GameWorld using this anchor name. class MyElement extends BehaviorElementClass public func new() ECBehaviorAnchorElement.new(this) end end ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]