- Home /
Multiple Sprite animations
So I am wondering how I would implement a sprite sheet with multiple animations on it. Sofar I have this script that just goes from one offset to the other var uvAnimationTileX = 24; //Here you can place the number of columns of your sheet. //The above sheet has 24 var uvAnimationTileY = 1; //Here you can place the number of rows of your sheet. //The above sheet has 1 var framesPerSecond = 10.0; function Update () { // Calculate index var index : int = Time.time * framesPerSecond; // repeat when exhausting all frames index = index % (uvAnimationTileX * uvAnimationTileY); // Size of every tile var size = Vector2 (1.0 / uvAnimationTileX, 1.0 / uvAnimationTileY); // split into horizontal and vertical index var uIndex = index % uvAnimationTileX; var vIndex = index / uvAnimationTileX; // build offset // v coordinate is the bottom of the image in opengl so we need to invert. var offset = Vector2 (uIndex * size.x, 1.0 - size.y - vIndex * size.y); renderer.material.SetTextureOffset ("_MainTex", offset); renderer.material.SetTextureScale ("_MainTex", size); }
The problem now is that I would like to make it so that I can have one row be one animation and the next row could be another animation so I could animate a sheet like this
so I would really appreciate the help if someone would tell me how to do this. Thanks in advance.
I notest that the image may not work so I am just going to post a linklink text
I am not sure if this will bump but I will give it a shot
Answer by jason201 · May 12, 2013 at 12:18 AM
I fixed it.
What I did what have Two different plains with animated sprites then I wrote a code that would activate and deactivate the object depending on weather the character was moving or not.
Is this still the solution you are using or have you found a way to do it like you originally wanted, 1 animation per row in the sprite sheet? I'm trying to do just that and would like to find a solution for it, without replacing planes :P
Your answer
Follow this Question
Related Questions
Sprite Rect Moves Between Frames 0 Answers
How to show two 2D animations at the same time? 1 Answer
Animating a 2D character with this type of sprite 0 Answers
Running 2D Sprite Animation Once? 2 Answers
Animated Overlay Armor Sprite 1 Answer