Mecanim help

so I recently started using Mecanim and i wanted your help. I want to know how to make the character walk foward by pressing the ‘W’ key and it playing the foward_walk animation. I want a fairly basic javascript handmade. Please, this would be very helpful as i could not find any java script videos on Youtube

Actually it’s not about javascript or C#. First you should understand the mecanim logic.

Mecanim drives your character automatically by analyzing the animation keyframes. You have to give some commands to mecanim and it drives the character according to those commands.

Commands are parameters. You can create a walk parameter in mecanim and set it to 1 or -1 or in between. According to your mecanim state design, it’s gonna play the forward walk animation if the walk parameter > 0. it’s gonna play back walk if < 0 and play the idle animation if = 0

as long as it plays a walk animation, the character will move in the scene automatically. You don’t have to move it via scripting. You just set the walk parameter value via code.

You should watch this official tutorial for details.
http://video.unity3d.com/video/7362044/unity-40-mecanim-animation-tutorial