Table of Contents

,

Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorSky

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.

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix sky. .

path

Set path to sky resource to use.

order

Set order. Sky instances with higher order are rendered over sky instances with lower order.

controllerPlayback

Set name of playback controller or empty string if not used.

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 support element class to be persistable (setPersistable).

API Documentation

ECBehaviorSky.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

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

Behavior Factory

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>

Live Examples