Play Spine Animation Tracks Exactly Once in GameMaker:Studio
Spine Documentation. Below you will find comprehensive documentation for using Spine. Other resources for getting help include the Spine FAQ and Spine forum. Spine Editor. Spine User Guide Learn how to use all of Spine's editor features, from start to finish. Tutorial Videos These videos provide a visual, hands-on alternative to learning how to. I used Spine version 3.4.02 for this tutorial. Always use the recommended version of Spine for your version of GameMaker:Studio. The Problem While GameMaker:Studio does have an Animation end event, this event only reacts on the main animation track (track 0), and not on all the other tracks. Spine Twitch Streams. Join our weekly Twitch stream to learn new workflows and productivity tips, ask our rigging expert questions live, or simply hang out with your fellow Spine animators. If can't make it to the live streams, you can still watch the videos on our Twitch archive page.
Should work in GameMaker:Studio EA 1.99.525 (or newer).
Should work in GameMaker:Studio 2 (all versions).
This tutorial is written for GameMaker:Studio but everything is applicable to GameMaker:Studio 2.
I used Spine version 3.4.02 for this tutorial. Always use the recommended version of Spine for your version of GameMaker:Studio.
The Problem
Spine 2d Animation Tutorial
While GameMaker:Studio does have an Animation end event, this event only reacts on the main animation track (track 0), and not on all the other tracks. However, using the at-the-time-of-writing new Animation event event, you can now easily make sure that specific animations on any track only play once.
What to Do in Spine
Spine Animation Software
The first thing you need to do, is setting up a “stop” event in your animation. You do this in Spine, as I showcase in the video below.
As the video explains:
- You first add the event to your hierarchy.
- You then key the event at the last frame of the animations you want to stop after playing once (or wherever you want the animation to stop).
These animations will typically be secondary animations, and rarely the animations you place on track 0, as you can simply use the Animation end event for these, as explained before.
After this you of course export your character and loads it into GameMaker:Studio as a skeletal sprite.
What to Do in GameMaker:Studio
As there has not yet been written a manual entry on the subject of the Animation event event at the time of writing, you will have to use Nocturne’s forum post on the topic for reference. Nocturne flesh out multiple other Spine-related updates in this post.
When the sprite is added and attached to an object, we now add the Animation event event to the object as well. You find the event under the Other category. You then add a code block to the event.
Spine Animation Tutorial Pdf
The event is triggered by Spine events and automatically generates a ds_map. This ds_map is accessed through the variable event_data
local to the event. The ds_map contains multiple keys, but for our purpose we only need two: The “name” key, to check if the current event is the “stop” event, and the “track” key, to check which animation track the animation is running on.
Spine Animation Tutorial Free
Let’s begin writing the code. First we test for the correct event:
Note that I use the accessor “?” to easily look inside the ds_map. After that we simply turn off the animation track in question by using skeleton_animation_clear();
:
Spine 3d Animation
..and Voilá!
Now your animation will stop after playing exactly once! Yes, it is really that easy. Hope you enjoyed!
Spine Animation Tutorial For Kids
Regards,Simon