hey guys i have a problem with the jump action
when i press button Jump my character jumps but its jump animation does not finish.
the animation has to play once each time i press Jump
i know its no pro script but i am a biginner with programming
thanks guys
var minimumRunSpeed = 1.0;
function Start () {
// Set all animations to loop
animation.wrapMode = WrapMode.Loop;
// Except our action animations, Dont loop those
animation["shoot"].wrapMode = WrapMode.Once;
animation["jump"].wrapMode = WrapMode.Once;
// Put idle and run in a lower layer. They will only animate if our action animations are not playing
animation["idle"].layer = -1;
animation["walk"].layer = -1;
animation["run"].layer = -1;
animation.Stop();
}animation["jump"].wrapMode = WrapMode.Once;
function SetSpeed (speed : float) {
if (speed > minimumRunSpeed)
animation.CrossFade("walk");
else
animation.CrossFade("idle");
if (speed > minimumRunSpeed)
animation.CrossFade("jump");
else
animation.CrossFade("idle");
}
function Update() {
if( Input.GetKey( "w" ) )
{
animation.Play("walk");
}
if( Input.GetKeyUp( "w" ) )
{
animation.Stop("walk");
animation.Play("idle");
}
if( Input.GetKey( "s" ) )
{
animation.Play("walk2");
}
if( Input.GetKeyUp( "s" ) )
{
animation.Stop("walk2");
animation.Play("idle");
}
if (Input.GetButton ("Jump")) {
animation["jump"].wrapMode = WrapMode.Once;
animation.Play("jump");
if (animation.Play("jump")= false;
animation.Play("idle") = true;
}
}