Anim_X

Category: Animations
Since engine version: 1.0 OC

Description

The value depends on the movement into X direction. Every pixel moved into positive X direction increases the value a little bit, and each pixel moved into negative X direction decreases it. If end was reached then the value is reset to begin and if begin was reached then the value is reset to end.

Syntax

array Anim_X(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 chosen to be greater than begin then the value increases with movement into positive X direction, otherwise it decreases.
length:
Number of pixels to be moved into X direction for the animation to be played from begin to end.

Remark

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

Example

PlayAnimation("Drive", 5, Anim_X(0, GetAnimationLength("Drive"), 0, 15), Anim_Const(1000));
Plays the animation "Drive" in slot 5 and superimposes any other potential animations in slot 5. The animation is played the faster the faster the object moves into X direction. Once the object moved 15 pixels the animation will have been played from begin to end and it restarts from the beginning. Here we use Anim_X instead of Anim_AbsX so that the wheels of a vehicle turn backwards when driving backwards.
See also: Anim_AbsX, Anim_AbsY, Anim_Action, Anim_Const, Anim_Dist, Anim_Linear, Anim_R, Anim_XDir, Anim_Y, Anim_YDir, PlayAnimation, SetAnimationPosition, SetAnimationWeight
Clonk-Karl, 2010-01