How to have a good looking character animation?

Started by
4 comments, last by Alberth 4 years, 11 months ago

Hello, I'm working on a 2D isometric game, and my character's animation doesn't satisfy me: The character kind of slips on the ground.

The animation looks like this (with this animation file). The code is similar to this:


// Moving character at south east
character.pos.x += 8; // pixels
character.pos.y += 4;
++character.animation.frame;

Do you have any tips to improve it?
Thanks

Advertisement

Analyze the image, determine how far the feet move between consecutive frames (relative to some "root" position, like the center of their head or something). Store that offset with the frame data, move the character only that far each frame.

For the five frames below, I drew a line from the player's nose to the tip of their left (backwards-moving, and therefore "planted" and presumably unmoving foot). In frame #1, it's at +1x from the nose. In frame #2, it's at -9x, and therefore moved -10x. So, when driving the character, the player's sprite should move forward by about +10 pixels. One frames #3 and #4, the toe is at -14x and -19x, so the character should move forward by another +4 and +5 pixels, respectively, before those frames.

Naturally, you'll want to use that as a guideline; the player won't be moving directly east unless they are snapped to the grid, so you'll want to move the player in their precise travel direction vector, normalized and then multiplied by the magnitude measured by this process.

image.png.18ca961293d45487260cff99e02cd56a.png

 

If you're lucky, the person who made the animation used the same animation viewed from varying angles, instead of making eight bespoke animations, and so the magnitude of the foot's movement will be the same in all the rotations. Remember to account for the projection (10px in X is 5px in Y if the projection ratio between X and Y is 2:1).

RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.

Professionally-done animations are all using animation tools. You should not hardcode animation deltas in your code. You are already having issues animating one object, what do you think is going to happen when animating hundreds more different types of objects?

Thanks for replying, I understand your solution Wyrframe but it is quite long to hardcode animation deltas, as said alnite

I don't know if the animation was done professionally, I found it for free and no 3D model file was provided, is it the only possible solution?

It's definitely going to work at least.

Basically you want one foot to stick to the ground. As a first guess, I'd say it's the lowest foot, and the "back" one if there is a choice.

Maybe you can write a program that finds that foot in each frame and then compute offsets relative to it. Obviously this is not going to work 100%, at least when changing foot something has to be done (but a simple heuristic may work, eg don't move too much).

A simpler option could be to write a program where you align each frame on top of the previous frame manually, if the computer assists you eg like above, or by extra-polating movement in some way, it may be faster.

This topic is closed to new replies.

Advertisement