Hi, I'm trying to do a game with 2d graphics like Paper Moon. The character should be sprite animated, moving in a 3dmensional environment, giving a sort of paper mario feeling. I googled a lot about using planes, animating spritesheets, using the offset,even managed to use the code in the wiki, but what I can't understand is how to associate the animation to the controls.
How do I trigger the tiled animations (walk animation when walking, run animation when running, etc.)? Because my character can walk and jump, but it's not properly animated. I'm using the scripts contained in the 2d platformer tutorial.
Thanks in advance.
asked Jul 13 '10 at 03:06 PM
I'm assuming that you would just be changing which material/animation/sprite/whatever you're using in the same place the 2D platform tutorial crossfades/plays different animations.
answered Jul 13 '10 at 03:27 PM
Try page 12 of the Evac City tutorial.
Using the built-in animator is probably not the way to go, since you need to "snap" the material to a particular offset. Doing this in code is much easier.
You could do this in a separate animation script, or you could simply modify the PlatformerController. Look for the part of the script where movement is happening, and just add your own code to check isGrounded, isMoving, etc. and change the texture offset accordingly.
To get the proper framerate for your animations, you can store Time.time whenever you change the offset and then make sure a certain amount of time has elapsed before changing it again.
answered Jul 27 '10 at 05:45 PM