The problem is simple but it seems the solution isn’t it would seem. I want my character to jump using
//the rest of the code as been omitted down to the jumping functions.
function Jump ()
{
if (Input.GetAxis("Vertical") Input.GetButtonDown ("Jump"))
moveDirection.y = jumpSpeed;
else
{
animation.CrossFade("standjump", 0.1);
yield WaitForSeconds(0.3);
StandingJump();
}
}
function StandingJump ()
{
moveDirection.y = stillJumpSpeed;
}
in short when the player presses the space bar, if they are moving the character will perform a leap forward at a set height. If, however, the character is standing still they will perform a jump at a different height using a more detailed animation.
The animation has anticipation with the character crouching into the jump. I want to stall or delay the jump until the animation has reached the right point.
I can’t.
Any yield that comes before the moveDirection.y will cause the script to just plain ignore it altogether.
I even tried setting an animation event to run
function StandingJump ()
{
moveDirection.y = stillJumpSpeed;
}
on the lift off frame with no luck; still didn’t cause the jump to happen.
However, if I remove all the fancy code and just ask my character jump using moveDirection.y = stillJumpSpeed as soon as the button is pressed it works!
if there is a yield anywhere before the moveDirection.y it kills the whole thing.
Anyone got anything on this subject?