This function is only for use with instances which have sprites assigned to them created using the skeletal animation program Spine. While you can draw these sprites using the normal draw functions (like draw_self()), there are times when you may want to draw a single frame or show a change of skin texture without actually changing the sprite properties for an instance. In these cases you can draw the sprite that has been assigned to the instance with this function, where you give the unique Instance ID and then the name of the animation to get the frame from (a string, as set within the program used to make the sprite). Next you give the name of the skin to use (again, as set when the sprite was made), and a frame value. The frame value is for telling GameMaker Studio 2 what part of the animation to show and is a value between 0 and the image_number. The rest of the arguments are the same as those used for normal sprite drawing and will change the scale, angle, blend colour and alpha of the final animation frame being drawn.

WARNING! Because of the way skeletal animations are interpolated between various "key" frames, there is an additional overhead associated with this call and therefore it is recommended that you avoid drawing skeleton based sprites using this method unless absolutely necessary.
IMPORTANT! This function is not available with the Trial Licence of the product.


draw_skeleton_instance(instance, animname, skinname, frame, x, y, xscale, yscale, rot, colour, alpha);

Argument Description
instance The index of the instance to draw the sprite from.
animname The name of the animation to get the frame from (a string).
skinname The name of the skin to use (a string).
frame The animation frame to draw (from 0 to image_number - 1).
x The x coordinate of where to draw the sprite.
y The y coordinate of where to draw the sprite.
xscale The horizontal scaling of the sprite, as a multiplier: 1 = normal scaling, 0.5 is half etc...
yscale 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.
alpha The alpha of the sprite (from 0 to 1 where 0 is transparent and 1 opaque).




draw_skeleton_instance(obj_Player, "jump", "skin1", 0, x, y, 1, 1, 0, c_white, 1);

The above code will draw the first frame of the skeletal animation sprite assigned to the instance given, using the "jump" animation set and the skin defined as "skin1".

Back: Drawing Sprites And Tiles
Next: draw_skeleton_collision
© Copyright YoYo Games Ltd. 2019 All Rights Reserved