well actually i’ve got a problem with my logical thinking because i’m new with JS, i want to use one input that runs two actions instead of two inputs. so what i want is when i press the F key the lift will play animation “LiftUp” and when i press F key again it will play animation “LiftDown”. here’s the script…i really appreciate any kind of suggestions/corrections from the members, thx
var liftSound : AudioClip;
var EnterTrigger : boolean = false;
function OnTriggerEnter (Col : Collider){
if(Col.gameObject.tag == "Player"){
EnterTrigger = true;
}
}
function OnTriggerExit (Col : Collider){
if(Col.gameObject.tag == "Player"){
EnterTrigger = false;
}
}
function Update () {
if( EnterTrigger == true ){
if(Input.GetKey(KeyCode.F)){
audio.PlayOneShot(liftSound, 1.0 / audio.volume);
animation.Play("LiftUp");
}
}
if( EnterTrigger == true ){
if(Input.GetKey(KeyCode.G)){
audio.PlayOneShot(liftSound, 1.0 / audio.volume);
animation.Play("LiftDown");
}
}
}
thanx, i will try that
– sistematix