- Home /
 
 
               Question by 
               logging_out · Aug 08, 2011 at 03:04 AM · 
                javascriptattackcombo  
              
 
              Combo Attack Chain Script Help
So I was trying to figure out a way how to create a Combo Attack Chain using animations. I asked around in the Unity Forums here, but I couldn't get the answer I wanted. Here's the scrip that I was trying to use:
     animation["Attack1"].wrapMode = WrapMode.ClampForever;
     animation["Attack1Reuturn"].wrapMode = WrapMode.Once;
     animation["Attack2"].wrapMode = WrapMode.ClampForever;
     animation["Attack2Return"].wrapMode = WrapMode.Once;
     animation["Attack3"].wrapMode = WrapMode.ClampForever;
     animation["Attack3Return"].wrapMode = WrapMode.Once;
     animation["Attack4"].wrapMode = WrapMode.Once;
     
     function Start () {
         if(Input.GetButtonDown("Fire1")){
             animation.Play("Attack1");
             
         }
     }    
     function Update () {
         if(Input.GetButtonDown("Fire1") = Time.deltaTime * 1;
         animation.Play("Attack2");
         
         else animation.Play("Attack1Return");
         
     }
     
     function Update () {
         if(Input.GetButtonDown("Fire1") = Time.deltaTime * 1;
         animation.Play("Attack3");
         
         else animation.Play("Attack2Return");
         
     }
 
 function Update () {
     if(Input.GetButtonDown("Fire1") = Time.deltaTime * 1;
     animation.Play("Attack4");
     
     else animation.Play("Attack3Return");
     
 }
 
               And here's the script that someone else suggested starting with and adding on to:
 var timer : float=0.0;
 var stage : int=0;
 
 if(Input.GetButtonDown&&Time.time>timer+1.0)
 {
 if (stage==0)
 //play your first animation here
 int+=1;
 timer=Time.time;
 }
 
               I'm new to javascript and I don't really understand what's happening in the second script, nor do I know how I would add onto it to do what I want. Help with either script would be much appreciated.
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Castlevania style stop and attack script. 0 Answers
Need help with simple RayCast Attack script 1 Answer
I need help with my health script 2 Answers
Cooldown Function Problem 1 Answer
Punching - what would be the better way? (in javascript) 2 Answers