Draws a frame from a given skeletal animation using sprite transforms.


GML Code Example

draw_skeleton(sprite, animname, skinname, frame, x, y, xscale, yscale, rot, colour, alpha);

Argument Description
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 (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).

Returns: N/A


This function is only for use with sprites that have been created using a skeletal animation program like 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. In these cases you can draw the sprite with this function, where you give the sprite index 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 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: Spine integration in GameMaker: Studio is a Pro licence feature and will not work in the Free/Standard versions.


GML Code Example

draw_skeleton(spr_Jump, "jump", "skin1", 0, x, y, image_xscale, image_yscale, image_angle, c_white, 0.5);

The above code will draw the first frame of the given skeletal animation sprite, using the "jump" animation set, the skin defined as "skin1" and at the same scale and position as the instance properties define, but with an alpha of 0.5.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here