- Home /
 
 
               Question by 
               hugemaggot · Dec 14, 2010 at 09:27 PM · 
                animation  
              
 
              playing animation on button press
can anyone tell me how i would make my character move forward whilst it plays the walk animation that ive created when i press the w,a,s,d keys?
               Comment
              
 
               
              Answer by Uriel_96 · Dec 14, 2010 at 09:30 PM
maybe try this:
if(Input.GetKey("w")){
transform.Translate(transform.forward * Time.deltaTime);
animation.Play("walk");
}
//and there you continue
 
              when i attached the script to my character it does nothing could you please help? but thanks anyway for having a go.
what do you mean with does nothing, what exactly is not working, the animation, press the button or the translate?
Oh no, maybe I see my problem, I put Input.Get$$anonymous$$eyDown, the correct form is to put is Input.Get$$anonymous$$ey
so lets go back to my question, what exactly doesnt work, the animation, translate or the button? and also if you get an error say it please.
Your answer