There are many instances in a video game where you want an animation to trigger some kind of action
within the game engine. In Spriter we call these “Events”. A common event you might want to trigger at
key points of an animation would be the creation and firing of a bullett sprite at the exact moment of a
muzzle flash in a gun firing animation. Of course, it can get much more sophisticated than that. You
might want to trigger several events at once, or several over the course of an animation. This is very easy
with Spriter Pro. For the sake of keeping these simple we’ll use the shooting animation example.
Adding “Events” to an Animation
2) A small dialogue will appear which allows you name your Event. Just type in the name you want this
event to have and click “OK” or press enter. This places your new event trigger at that spot in the timeline.
The logic in your game engine should look something like this:
If the event called “fire bullet” is triggered.
Then create a bullet sprite at the position of the spawning point called “gunbarrel”
And set the angle of the bullet sprite to the angle designated by the spawning point.
Set bullet sprite to whateve speed is apropriate.
A more sophisticated example of the use of “Events” would be a long animation of a wizard character
casting a spell. Imagine an early event to trigger the start of some lighting and weather effects as t he
wizard begins chanting his spell. Imagine shortly thereafter another event triggers the beginning of a
screen shake...subtle at first, but growing more powerful as the incantation nears it completion. And finally
an event timed perfectly when the wizard finishes the spell by slamming the end of his staff to the ground
for emphasis, which could trigger a much more violent camera shake, particle effects, universal damage to
on-screen enemies, etc etc. The possibilities are endless.
We’re not done yet though, if you pay close attention you’ll see that the new Event you created has room
for its own MetaData in its timeline! This means the events themselves can carry with them additional
information, giving you perfect control of the variables and settings involved with whatever it is you want
triggered in the game engine. Please see “adding variables to an animation” and “adding Tags to an
animation” to learn more.