Skips and jumps

Sadly, the title of this post doesn’t refer to the progress we’ve been making. We have been making progress, but not as fast as we’d like.

One snag we’ve caught ourselves on has come up when paying closer attention to transitions between animations, and other quirks that have cropped up as we’ve really started working on things. We’ve found the character flipping directions at odd times, changing size, and generally skipping from one animation to another at bad times, making the transitions kind of glitchy.

Animator controllers in Unity are varied, and essentially they’re what tells Unity what conditions should cause an object to switch from one animation to another. In line with the tutorials in Adventure Creator and elsewhere, we’ve been Sprite 2D Toolkitusing the ‘Sprites 2D Toolkit’ animator engine. It really easily allows you to set up the basic animations you’d need for a 2D game. Animations like Idle, Walk, Run and Talk. It does this by essentially automating your animator controllers for you so you don’t need to worry about making connections between various activities.

In the image to the right you can see a list of animations, but there’s nothing really joining them to each other. That’s because the Sprite 2D Toolkit is doing the work for you.

But if you want to fine-tune these animations, Sprites 2D Toolkit seems pretty limited. We’ve added a Crouch and Use animation so far. And our default animation, Idle, does have a bit of life. Ensuring all of this works well together, without the odd jumps and skips, has been a bit difficult.

There are other types of animator engines – we’ve gone for Sprites Unity Complex. It gives you a lot more control over how Unity manages specific animations and how they relate to each other. Now, we’ve by no means mastered this tool yet. But one of the things Sprites Unity Complex allows you to do is create layers within animations. So if you want your character to wave, and to run, and to wave while running, you can just create the first two and set them to two different layers. This way, certain parts of a player will animate under certain conditions without effecting other layers.

OK so the running and waving sounds kind of boring. But what about if after completing a puzzle the player struts around for 20 seconds, or after running around for a while she gets puffed out. These are the kinds of things that really add life and depth to the game, and having control over this fine-tuning will have huge benefits further down the track.

Another thing the more complex mode does is allows you to create parameters that define when certain animations are triggered or not. So if the character’s speed goes above average, the run animation plays. Or you might have two different idle animations, which are triggered depending on certain circumstances (like one idle for normal gameplay and one for mid-conversation). This should (in theory – we haven’t tested yet) even allow certain animation types to be triggered within particular regions. Sprites Complex

Here’s a much messier animator controller. It does look more complex. But in reality the logic of these pathways is pretty intuitive. Each line between two of the boxes (the orange one is the default state) represents the conditions in which one animation will change to another. There’s no direct line between our Talk animation and our Use animation because it’ll never come up in-game.

For detailed tutorials you’ll have to go here but for the time being it’s enough to say that we’re very excited by the potential this opens up. And it’ll hopefully make our work look much smoother and complete. Worth the extra time!

Leave a comment