- Home /
Animation Problem
Hello, I'm on a 2D platform game, i made a simple CharacterController script and i am now working on the animations. I made a script for that but it doesn't seem to work. I don't know, they may be other ways to make animations work. This is the animation Script, shall I show you the Move Script ?
function Start () {
animation.Stop();
animation.wrapMode = WrapMode.Loop;
var jump = animation["jump"]; jump.layer = 1; jump.wrapMode = WrapMode.Once;
var run = animation["run"]; var idle = animation["idle"];
}
function Update () {
var controller : CharacterController = GetComponent(CharacterController);
if (controller.IsMoving()) { animation.CrossFade ("run"); } else animation.CrossFade("idle"); }
It says that IsMoving is not a propper Method.
Answer by Loius · Oct 23, 2010 at 08:21 PM
There is no "IsMoving" function. You have to determine whether it's moving yourself. Usually that's done alongside the movement function .Move, since if you're not moving by zero then you are moving.
Oh thanks very much, what form would it take in code ? like controller.$$anonymous$$ove > 0 ?
How are you moving your character? You pass a vector in to the .$$anonymous$$ove and the .Simple$$anonymous$$ove functions. If that vector is the zero vector then there's no movement.
Your answer
Follow this Question
Related Questions
Moving BoxCollider2d with animation is not the right way? 2 Answers
Animator and Scripting problems. Help !! 1 Answer
How to make enemy run animation 3 Answers
2D Animation. Changing to sprites with different pivots. 0 Answers
How to call an sprite animation, hide the main character and show him again in another spot? 2 Answers