Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorWorld
Behavior loads world file and adds contained content to the the game world this element is located in.
This behavior can be added multiple times to an element. Use the behavior identifier to tell them apart.
Element class properties have the prefix world.
or world({id}).
if id is not empty.
Set path to world file to use.
world.path
or world({id}).path
*.deworld
<string name='world.path'>room_storage.deworld</string>
Set position relative to element matrix to add created content at.
world.position
or world({id}).position
<vector name='world.position' x='0' y='-1' z='0'/>
Set orientation relative to element matrix to add created content at.
world.orientation
or world({id}).orientation
<vector name='world.orientation' x='0' y='180' z='0'/>
This behavior has no events.
This behavior requires no other behaviors.
This behavior does not support optional behaviors.
This behavior does support element class to be persistable (setPersistable).
Since DragonScript Module Version 1.26
This example defines an element which loads a single world.
class MyElement extends BehaviorElementClass public var ECBehaviorWorld world func new() world = ECBehaviorWorld.new(this) world.getPath().setPath("/content/worlds/storageRoom.deworld") end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <!-- add world behavior --> <behavior type='ECBehaviorWorld'> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.path'>/content/worlds/storageRoom.deworld</string> </behavior> <!-- for adding multiple behaviors use unique identifiers --> <behavior type='ECBehaviorWorld' id='second'/> </elementClass>