User Tools

Site Tools


dragengine:modules:dragonscript:behavior_sky

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.

  • Full name: sky.path
  • Type: string
  • Default Value: empty string
  • Expected File Pattern: *.desky
  • Example (*.deeclass)
    <string name='sky.path'>default.desky</string>

order

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

  • Full name: sky.order
  • Type: integer
  • Default Value: 0
  • Example (*.deeclass)
    <integer name='sky.order'>1</integer>

controllerPlayback

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

  • Full name: sky.controllerPlayback
  • Type: string
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='sky.controllerPlayback'>playback</string>

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

  • Add sky to game world.

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

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_sky.txt · Last modified: 2025/03/13 17:16 by dragonlord