- Home /
how to run Sprint
Help. I do not know how to do when you hold the left shift is a character starts to run and release it when the form starts normally go. This is my script "Movement"
pragma strict
var animator: Animator;
var h: float;
var v: float;
function Start () {
animator = GetComponent (Animator);
}
function Update () {
h = Input.GetAxis ('Horizontal');
v = Input.GetAxis ('Vertical');
if (Input.GetButton ('Jump'))
animator.SetBool ('Jump', true);
else
animator.SetBool ('Jump', false); }
FixedUpdate function () {
animator.SetFloat ('Speed', v);
animator.SetFloat ('directrion', h);
}
Answer by RedDevil · Mar 25, 2014 at 06:51 PM
You havent even done anything for the sprint function. You must think what sprint is... it is just walking faster with a run animation.So just make it so when you press shift you have increased movement speed and to play a sprint animation.I will not give you the code since i belive you should learn the basics first.I sugest you watch Brackeys on youtube as his tutorials are awesome for newbie unity users. http://www.youtube.com/user/Brackeys/playlists
Your answer
Follow this Question
Related Questions
Loop animation on button hold 2 Answers
When my button is pressed the action reapeats 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
A node in a childnode? 1 Answer
Switch Camera On Button Press? 2 Answers