Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorSky
Behavior element behavior adding sky support.
Adds a SkyInstance resources to the world with support to mainpulate controllers. If a playback controller is set it is updated with the elapsed time. Other behaviors can update individual named controllers to add special effects.
Multiple skies can be added to a game world by different elements. In this case the graphic module concatenates them as if one single sky is used. This allows to split skies into multiple sky instances to add individual effects easily. To ensure the correct drawing order each sky is required to have a unique order value. Higher order values are rendered ontop of lower order values.
This behavior can be used only once on an element.
Element class properties have the prefix sky.
.
Set path to sky resource to use.
sky.path
*.desky
<string name='sky.path'>default.desky</string>
Set order. Sky instances with higher order are rendered over sky instances with lower order.
sky.order
0
<integer name='sky.order'>1</integer>
Set name of playback controller or empty string if not used.
sky.controllerPlayback
<string name='sky.controllerPlayback'>playback</string>
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.0
This example defines an element which adds a sky.
class MyElement extends BehaviorElementClass public var ECBehaviorSky sky func new() sky = ECBehaviorSky.new(this) 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'> <behavior type='ECBehaviorSky'> <!-- optional: set layer mask (default empty). list of bits to set. --> <string name='layerMask'>0 1 4</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.path'>default.desky</string> </behavior> </elementClass>