Table of Contents

,

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

ECBehaviorRidable

Behavior adding support to elements to be ridden by actors.

Actors will attach using relative mode if ECBehaviorProjectToGround hits this element.

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix ridable..

Events

This behavior has no events.

Required Behaviors

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does support element class to be persistable (setPersistable). Saves selected color.

API Documentation

ECBehaviorRidable.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

This example defines an element which can be rode by the player.

class MyElement extends BehaviorElementClass
  public var ECBehaviorComponent component
  public var ECBehaviorCollider collider
  public var ECBehaviorRidable ridable
  func new()
    component = ECBehaviorComponent.new(this, null)
    collider = ECBehaviorCollider.new(this, component)
    ridable = ECBehaviorRidable.new(this, collider)
  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='ECBehaviorComponent'/>
  <behavior type='ECBehaviorCollider'/>
 
  <behavior type='ECBehaviorRidable'>
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.name'>value</string>
  </behavior>
</elementClass>

Live Examples