Category: Animations
Since engine version: 6.0 OC


The value depends on the distance travelled by the aboject. Every pixel the object moves increases the value a little bit. Once end has been reached the value is reset to begin. This is a combination of Anim_AbsX and Anim_AbsY, where the movement in both coordinates is considered.


array Anim_Dist(int position, int begin, int end, int length);


Start value. Should be inside the interval given by begin and end.
Start of the interval.
End of the interval. If end is greater than begin then the value increases with every movement of the object, otherwise it decreases.
Number of pixels to be moved for the animation to be played from begin to end.


See the animation documentation for further explanations of the animation system.


PlayAnimation("Fly", 5, Anim_Dist(0, 0, GetAnimationLength("Fly"), 20), Anim_Const(1000));
Plays the animation "Fly" in slot 5, superimposing any other potential animations in slot 5. The animation is played the faster the faster the object moves. Once it moved 20 pixels the animation has been played from begin to end and restarts at its beginning. This could be used for an engine animation of a flying object where the engine should only be animated as long as the object is moving.
See also: Anim_AbsX, Anim_AbsY, Anim_Action, Anim_Const, Anim_Dist, Anim_Linear, Anim_R, Anim_X, Anim_XDir, Anim_Y, Anim_YDir, PlayAnimation, SetAnimationPosition, SetAnimationWeight
Clonk-Karl, 2014-10