draw_skeleton_time(sprite, animname, skinname, time, x, y, xscale, yscale, rot, colour)
参数 | 描述 |
---|---|
sprite | The index of the sprite to draw. |
animname | The name of the animation to get the frame from (a string). |
skinname | The name of the skin to use for drawing (a string). |
time | The time-frame to draw the animation at (from 0 to the end duration, in seconds). |
x | The x coordinate of where to draw the sprite. |
y | The y coordinate of where to draw the sprite. |
x轴缩放 | The horizontal scaling of the sprite, as a multiplier: 1 = normal scaling, 0.5 is half etc... |
y轴缩放 | The vertical scaling of the sprite, as a multiplier: 1 = normal scaling, 0.5 is half etc... |
rot | The rotation of the sprite. 0=normal, 90=turned 90 degrees counter-clockwise etc. |
colour | The colour with which to blend the sprite. |
返回: N/A(无返回值)
This function will draw the given animation using the given skin at a specific time in the animation. The time value should be between 0 (the beginning) and the end duration of the animation, which you can find using the function skeleton_animation_get_duration(). You can set the time value to values higher than the total duration of the animation and the animation will loop back to the beginning, but you run the risk of losing floating point accuracy as the accumulated time gets larger.
var time += delta_time / 1000000;
var d = skeleton_animation_get_duration("walk");
if time > d time -= d;
draw_skeleton_time(sprite_index, "walk", "skin1", time, x, y,
image_xscale, image_yscale, image_angle, c_white);
The above code will draw the given skeletal animation sprite using delta-time to set the frame being drawn.