User Tools

Site Tools


dragengine:modules:dragonscript:behavior_animated

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dragengine:modules:dragonscript:behavior_animated [2025/03/12 14:43] – [ECBehaviorAnimated] dragonlorddragengine:modules:dragonscript:behavior_animated [2025/03/13 17:10] (current) dragonlord
Line 1: Line 1:
 {{tag>dragonscript behavior}} {{tag>dragonscript behavior}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorAnimated**+[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorAnimated**
 </WRAP> </WRAP>
  
Line 14: Line 14:
  
 To use this behavior make sure to add first the [[behavior_component|ECBehaviorComponent]] to animate. To use this behavior make sure to add first the [[behavior_component|ECBehaviorComponent]] to animate.
- 
-Because multiple animator behaviors can animate the same component behavior the animator behavior has an own identifier. In the example above the first string parameter is the animator behavior identifier while the second string parameter is the component behavior identifier to animate. 
  
 See also: See also:
Line 110: Line 108:
  
 A typical usage pattern for such behaviors is to locate the animator controller to update during construction time and to manipulated the controllers inside updateControllers(). A typical usage pattern for such behaviors is to locate the animator controller to update during construction time and to manipulated the controllers inside updateControllers().
 +
 See [[#element_class_example|Element Class Example]] for example code. See [[#element_class_example|Element Class Example]] for example code.
  
Line 132: Line 131:
 ====== Required Behaviors ====== ====== Required Behaviors ======
  
-This behavior requires these other behaviors: 
   * [[behavior_component|ECBehaviorComponent]]   * [[behavior_component|ECBehaviorComponent]]
  
Line 165: Line 163:
     component = ECBehaviorComponent.new(this, null)     component = ECBehaviorComponent.new(this, null)
     animated = ECBehaviorAnimated.new(this, component)     animated = ECBehaviorAnimated.new(this, component)
 +  end
 +end
 +</code>
 +
 +Example of using listeners.
 +
 +<code>
 +class MyListener extends ECBehaviorInstance.DefaultListener
 +  var AnimatorController pController
 +  
 +  func new(ECBehaviorAnimated behavior)
 +    pController = behavior.getAnimatorInstance().getControllerNamed("special controller")
 +  end
 +  
 +  func void updateControllers(Instance instance, float elapsed)
 +    pController.increment(elapsed)
   end   end
 end end
dragengine/modules/dragonscript/behavior_animated.1741790599.txt.gz · Last modified: 2025/03/12 14:43 by dragonlord