I guess the main (and most time-consuming) animation for robots is their movement. I can imagine three distinct ways of moving: walking, driving, and flying. Walking is the most difficult one and means the robot has legs or some sort of appendages that they move in sync. I can imagine bipod or quad/hexapod robots. This would need a walk cycle animation and some finicky sprite timing. Driving and flying are fairly similar, except they have different animation methods. Driving remains on the ground and activates some sort of wheels or tank threads. Flying hovers and propels around with some sort of jet or something. If I can get all three working, that would sort out the movement for now.

So my mob animations have custom states and each part has custom sprite and offset options (for each state). To expand it with additional animation values, I would have to specify an animation for it:

This means my main animator must also have sub-animators for each part now. (I don’t know if using Unity’s animator would be better or not, I am reinventing the wheel a little here. But I also want “add and done” features here.) And if I am to do something like “walking”, then it makes sense to define the exact movement, which I will do with a timer, distances and curves:

And if I wire everything up for animated preview in the editor, I get this lovely walk cycle (other direction logic pending):

This isn’t a real hand-crafted animation, of course. And the curve is super simple. But these are robots, so an animation that looks mechanical instead of organic is perfectly fine, in fact, it’s preferred. As long as it is deliberate and smooth, it’s believable.

Now that I started animating things, I have to consider that they are direction-dependent. So, firstly, I need to animate depending on the direction, which means flipping the x offsets when the direction is “flipped” (moving left):

(Trying to GIF-capture Unity editor is glitchy, so these will have weird timing artefacts.)

I also need to adjust the layers for parts too. With that, this looks great (with a little torso/head wiggle added):

I said “my stuff is symmetrical”, but that’s actually wrong.  In short, mobs can walk left/right and they can move left/right. But the sprites are not symmetrical — “back leg” should always be the back leg. I don’t need the left/right layer distinction, as the whole sprite gets moved to the other side:

Long story short, here is the same mob, but walking correctly in all four combinations:

In short — the sprite positions flip on the X axis when the mob facing direction flips. But the movement animation flips only if the movement direction flips. So the mobs can “walk” backwards with the same animation. So the base sprite position is view-dependent, but part sprite offset is movement-dependent. This isn’t technically accurate, but good enough for “robots” with exaggerated mechanical movement.

Anyway, this again took a lot of time to get right. There’s not too much to say, but the visual results are really good (if I can say so). I’ll start adding more animations and different mob types soon.

Related Posts

MicroRogue DevDiary #57 – Mob part animation
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *