Category: Animations
Since engine version: 1.0 OC
Anim_Y
Description
The value depends on the movement of the object in Y direction. Each pixel the object moves into positive Y direction increases the value a little bit, and each pixel in negative Y direction decreases it. If end is reached then the value is reset to begin, and if begin is reached then the value is reset to end.
Syntax
array Anim_Y(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 movement into positive Y direction, otherwise it decreases in that case.
- length:
- Number of pixels that need to be moved in Y 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("Scale", 5, Anim_Y(0, GetAnimationLength("Scale"), 0, 15), Anim_Const(1000));
Plays the animation "Scale" in slot 5, superimposing any other potential animations in slot 5. The animation is being played the faster the faster the object moves into Y direction. After the object moved 15 pixels the animation has been played form start to end and restarts from the beginning. Here we use Anim_Y instead of Anim_AbsY so that the animation is played in the opposite direction if scaling downwards. begin was chosen to be greater than end so that the animation is played forwards for movement in negative Y direction (climbing upwards) and so that it is played backwards for movement in positive Y direction (climbing downwards).