hi i working on my sidescroll game but i stuck on this problem, walk animation works fine but when my joystick position is bigger or smaller than 0.3 still playing walk animation
here is my script
var JoystickScript:Joystick;
var JoystickPos:Vector2;
var run:AnimationState;
function Start()
{
run = animation["run"];
run.layer = 1;
run.blendMode = AnimationBlendMode.Blend
}
function Update () {
JoystickPos = JoystickScript.position;
if (JoystickPos.x > 0.1){
animation.CrossFade ("walk");
} else if (JoystickPos.x < -0.1){
animation.CrossFade("walk");
} else if (JoystickPos.x > 0.3){
animation.CrossFade("run");
} else if (JoystickPos.x < -0.3){
animation.CrossFade("run");
} else {
animation.CrossFade("idle");
}
}