what is wrong with my animation Code and if their anther easier way to animate from animation to anther it will be helpful if any one Could help when i jump for the first time the character jumps with nice 4 animations but the second time only the last animation which work i stayed half hour looking at the script but no Result this is all my jump animations please anyone help
void Start(){
animation["jump2fall"].layer = 4;
animation["fall"].layer = 6;
animation["fall"].wrapMode = WrapMode.Loop;
animation["run2jump"].speed=2;
animation["jump1"].speed = 2;
run = false;
started = false;
animation["jumploop"].layer = 5;
animation ["jump1"].layer =2;
animation ["run2jump"].layer = 1;
animation ["run2jump"].wrapMode = WrapMode.Once;
animation ["jump1"].wrapMode = WrapMode.Once;
animation ["jumploop"].wrapMode = WrapMode.Loop;
animation ["jump2fall"].wrapMode = WrapMode.Once;
}
void FixedUpdate(){
if (run && Input.GetButtonDown("Jump")&& !started ) {
animation.CrossFade("run2jump");
run = false;
animation["run2jump"].enabled = false;
started = true;
}
if(!started3 && falling && !animation.IsPlaying("jumploop") && jumping && !Grounded){
animation.CrossFade("jump2fall");
animation["jump2fall"].enabled = false;
started3 = true;
}
if(started3){
animation.Stop ("jump2fall");
}
void Update ()
{
if(Grounded){
animation.Stop ("fall");
jumping = false;
animation.Stop("jumploop");
animation["run2jump"].enabled = false;
animation["jump1"].enabled = true;
toloop = false;
animation["fall"].enabled = false;
animation["jump2fall"].enabled = false;
falling = false;
}
}
if(Gup){ // if Going up
animation["jump2fall"].enabled = true;
animation["run2jump"].enabled = true;
}
if(!Grounded){
animation["fall"].enabled = true;
}
if(animation.IsPlaying("jumploop") && Grounded){
animation.Stop("jumploop");
animation.CrossFade("idle");
}
if(falling){
animation.Stop("jumploop");
}
if(falling){
animation["run2jump"].enabled = false;
animation["jump1"].enabled = false;
animation["jumploop"].enabled = false;
}
if(Gup){
animation["run2jump"].enabled = true;
animation["jump1"].enabled = true;
animation["jumploop"].enabled = true;
}
if(animation.IsPlaying ("jumploop"))
{
animation["run2jump"].enabled = false;
animation["jump1"].enabled = false;
}
void LateUpdate ()
{
if (!animation.IsPlaying ("jump1") && toloop && Gup) {
started2 = false;
animation.CrossFade ("jumploop");
jumping = true;
}
if(started3 && falling && !animation.IsPlaying("jump2fall") ){
animation["jump2fall"].enabled = false;
animation.CrossFade("fall");
started3 = false;
if(animation.IsPlaying("fall")){Debug.Log("faal");}
}
}
}
asked
Jul 03 '12 at 08:42 PM
NotImpossible
-8
●
2
●
9