x


jumping animation

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");}
 }

 }
}
more ▼

asked Jul 03 '12 at 08:42 PM

NotImpossible gravatar image

NotImpossible
-8 2 9

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x223

asked: Jul 03 '12 at 08:42 PM

Seen: 365 times

Last Updated: Jul 03 '12 at 08:42 PM