The past 2 days I’ve been working extensively on integrating the abilities for Phoenix, the main character of the The Forbidden Arts. Phoenix is a pyromancer so it’s only fitting he has several different abilities to manipulate fire. I thought it would be cool to show what goes on behind the scenes in game development and focus on animation events in relation to one of the abilities of the game called “Rain of Fire.”
In the Forbidden Arts you have an action button (or key) that is used to trigger whatever the current active ability is. The “Rain of Fire” ability allows Phoenix to summon a shower of meteors that causes massive damage to any enemies they hit, and can also cause damage to the environment that can be beneficial to the player. Now let’s get to the fun part: seeing how this ability gets put together. It’s a combination of a character animation, animation events attached to the specific animation, particle effects and code.
Above is a screenshot showing the specific animation clip for the Rain Fire ability. You will notice there are 3 white markers along the timeline for the animation. These are events that will be called to perform a specific function during the animation. Each event will call the function named Ability and I pass through an integer parameter value of 0 for the first event, 3 for the second event, and 1 for the third event. The game object containing the player’s animator controller has a script attached to it called “Player Events,” and within this script is the function “Ability.” The first value of 0 sets the player in a brief uncontrollable state while he begins to play the animation. The second value of 3 calls a coroutine that summons the meteors, and the third value of 1 tells the player to reset the ability and enter the idle animation.
That’s the basics of how animation events work. Animation Events are a simple and very effective feature used to apply specific actions, effects etc during an exact point in an animation. The Forbidden Arts is full of animation events. Nearly every animation for every character that isn’t a loopable animation like an idle, walk, run etc, has at least one event attached to it. Check out the GIF at the top of the Blog to see “Rain of Fire” in action.