- Home /
2.5 platformer sprite animated character
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.
Answer by Tetrad · Jul 13, 2010 at 03:27 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.
I don't understand, is it something I need to put in the animation script? Lerpz, the default player, is given with a set of imported-animations of 3d models. The animation script seems to call the animations whenever is needed to. I've tried to make an animation using Unity built-in animator in which I change the offset of my spritesheet from frame 0 to 4. This way I could make an animation instance which could be triggered by the given script, but the Unity animator seems to try to blend the frames together, not displaying them instantly like the code I took on the wiki.
Answer by Ehren · Jul 27, 2010 at 05:45 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.
Answer by nantas · Aug 12, 2011 at 02:50 PM
check out this new tool set called ex2D: http://www.ex-dev.com/ex2d/index.html
it's very easy to use and use the same workflow to create 2D content as other Unity built in tools.