I am trying my hand at making a 2D test game. I want to test the mechanics of a 2D game. The problem is, i do not know how to animate the sprites. I got a sprite sheet offline to test with, but i do not know how to go about animating it depending on what input is given or how to change the sprite shown. What is the best way to do this, and can you give me a quick example of what the script should look like?
Also, i tried the Sprite Manger bundle found on the Unify wiki but it is written in C#, so i can not make heads or tails of it, so i cant break it down to learn how to use it, and i do not want to shell out the cash for Sprite Manage 2.
There are 2 common ways of doing it each with their own advantages:
Create a sprite map using Texture2D to pack your textures and give you rects for the uvs. Then, you just set up a timer to cycle through each rect and match the uvs with the rect. This is easy to do, and let's you have images that are not equal to each other without adding much work to your calculations. The biggest disadvantage is that it is expensive to recalculate the uvs every frame.
The other way is to animate the sprite using the texture offset and scale in the material properties. Then set up a timer that scales and offsets the texture. The advantages is that it is faster than changing the uvs every frame. The disadvantage comes from the fact that it is more difficult to setup and it is hard to use Textures of different sizes.
you may want to check out
http://www.ezsprite.com , they have a nice spritesheet package for unity thats pretty cheap it's similar to the the animation system in flixel or cocos2d and comes with javascript and c# examples
I don’t know how clearly i could help you in this matter because me too in search of the same topic.anyway check this link and see if it helps you creating your own sprite sheet,am sorry its not with the unity, but i think you may get a little idea regarding the matter.hope so ,if it is not a helpful one pardon me …“http://www.adobe.com/devnet/flash/articles/using-sprite-sheet-generator.html” if it helps you go ahead … all the best…