Skip to main content
GameDev.net gamedev.net
🔒 Locked

sprite animation

Started by unknown3344 Feb 14, 2015 at 5:54 AM 2 replies 3.7k views
Original Post
unknown3344
unknown3344

I have a sprite-sheet for the walking animation of the main player which consists of 6 sub-images. So I created the player object for the game and I've tested the game but the animation appears to run very fast. I know I can change the code to make the animation speed more acceptable but I'm just wondering is there a formula to calculate the animation speed of the sprite to stimulate best result possible? I also forgot to mention that I'm using game maker studio engine for my game.

P.S. I'm running the game at 60 fps which basically means 60 steps per second.

frob
frob

Running at 60fps does not mean you need to animate at 60fps. Also every sprite sheet does not need to flip at the same rate.

The animation walking gait and running gate is something you should discuss with your animators BEFORE they do the drawings. You tell them the sprite needs to travel X pixels per second and you are planning to flip the sprite sheet at Y sprites per second. Then they can draw it accordingly.

If the animation is too quick or too slow the character will appear to be sliding as they travel, which is usually very disturbing.

Since you are working backwards, lay the images out in a graphics program and space them out.

Inside the graphics editor there will be some layout that looks more natural, perhaps swapping the images every 10 pixels traveled. Or maybe swapping them every 4 pixels traveled. Or maybe for a run you can have some swapped out at one rate (when the feet are on the ground) and others can be left for a few more pixels (the midair portion of a run).

unknown3344
unknown3344

Thanks for clarifying that the sprite animation doesn't need to be animated at 60 fps. Correct me if I'm wrong but what I understand from your answer is that the animation speed depends on the sprite-sheet itself and not on a particular formula.

Currently I'm just trying to make a full working 2d platformer engine for testing purposes and I have 0 skills in drawing and animating sprites, which is the main reason I choose to download a sprite-sheet from the internet.

frob
frob

Correct.

You might also flip sprites based on distance traveled. For example, if the gait is every 8 pixels, when the position is different by 8 change the image. If they move 6 pixels don't change the sprite yet. The exact number depends on the game, the resolution, the sprites in question.

That method can result in a little bit of slipping, but for many games it looks good enough.

There are many different options when it comes to animating motion. The tricky part is knowing how good is good enough, letting you put in a quick approximation rather than struggling to make everything absolutely perfect.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.