Tutorial
Page 4 of 10
Animation Sets
Before our sprite will show correctly, we need to tell GameMaker: Studio which animation set to use for drawing. The animation set should have been created by you in Spine, and the data
exported as part of the JSON file that you have imported as your player sprite.
Our tutorial sprite has two animation sets that we have called "run" and "jump", so we want to set our player sprite running using the following code in the Create Event
This function tells GameMaker which animation set to use to animate the sprite. However if you run the game now, you still won't see anything... So what's missing? Well one of the most interesting
and powerful properties of a skeletal animation sprite is the ability to "skin" it.
Skins
For GameMaker to draw your sprite, you must tell it which skin to use. The skin is the texture that will be used when drawing the individual parts of the sprite overlaid on the skeleton, and these skins will
have been created previously in Spine from individual static images.
Like animation sets, skins are named and in this tutorial we have four different skins: "DOT", "hotline", "knight" and "stealth", and to start with we want to use the "DOT" skin, since that's what our preview image
in the sprite editor defaults to. So, in the "oPlayer" Create Event add the following line of code after the one you just added:
You can now run your test game and you'll see the alien sprite running across room. It's worth noting here that the normal instance variables for controlling the sprite still work with Spine sprites, so you can, for
example, set the image_speed to 0.5 and have the sprite animate at half speed, or you can set the image_index to a specific value. You can also get the animation length from the
image_number variable, which returns the number of steps required to show the complete animation.
© Copyright YoYo Games Ltd. 2014 All Rights Reserved