Category: Animations
Since engine version: 6.0 OC
Anim_Dist
Description
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.
Syntax
array Anim_Dist(int position, int begin, int end, int length);
Parameters
- position:
- Start value. Should be inside the interval given by begin and end.
- begin:
- Start of the interval.
- end:
- End of the interval. If end is greater than begin then the value increases with every movement of the object, otherwise it decreases.
- length:
- Number of pixels to be moved for the animation to be played from begin to end.
Remark
See the animation documentation for further explanations of the animation system.
Example
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.