Voici le code
Code : Tout sélectionner
#pragma strict
function Start () {
}
function Update () {
if(Input.GetKeyDown(KeyCode.Z)){
animation.Play("running");
}
Code : Tout sélectionner
#pragma strict
function Start () {
}
function Update () {
if(Input.GetKeyDown(KeyCode.Z)){
animation.Play("running");
}
Code : Tout sélectionner
this.transform.Translate(0,0,1);
Code : Tout sélectionner
#pragma strict
this.animation.wrapMode = WrapMode.Loop;
function Start () {
animation.Play("neutral_idle");
}
function Update () {
if(Input.GetKeyDown(KeyCode.Z)){
transform.Translate (0, Time.deltaTime , 0, Space.World );
animation.Play("running_inPlace");
}
if(Input.GetKeyDown(KeyCode.Q)){
animation.Play("running_inPlace");
this.transform.Translate(-0.1,0,0);
}
if(Input.GetKeyUp(KeyCode.Z)){
animation.Play("neutral_idle");
}
if(Input.GetKeyUp(KeyCode.Q)){
animation.Play("neutral_idle");
}
if(Input.GetKey(KeyCode.Space)){
animation.Play("jump");
}
if(Input.GetKeyUp(KeyCode.Space)){
animation.Play("neutral_idle");
}
}
Et dans ton code :Matocs a écrit :...enfait j'aimerais que tant que la touche z est enfoncée , le personnage avance.
Code : Tout sélectionner
if(Input.GetKeyDown(KeyCode.Z)){
transform.Translate (0, Time.deltaTime , 0, Space.World );
animation.Play("running_inPlace");
}
....
if(Input.GetKeyUp(KeyCode.Z)){
animation.Play("neutral_idle");
}
Code : Tout sélectionner
if(Input.GetKeyDown(KeyCode.Z)){
animation.Play("running_inPlace");
transform.Translate (Vector3.forward * Time.deltaTime, Space.World );
}