- Home /
Question by
MrMonstr · May 11, 2013 at 06:15 PM ·
animationjavascriptbeginner
How would you reccommend adding the jumping animation to my script?
#pragma strict
function PlayAnimation(AnimName : String) {
if (!animation.IsPlaying(AnimName))
animation.CrossFadeQueued(AnimName, 0.3, QueueMode.PlayNow);
}
function Update () {
if (Input.GetAxis("Horizontal") == 0) {
if (Input.GetAxis("Vertical") == 0) {
PlayAnimation("ArmatureAction");
}
}
if (Input.GetAxis("Horizontal") < 0) {
PlayAnimation("walkL");
}
else if (Input.GetAxis("Horizontal") > 0) {
PlayAnimation("walkR");
}
if (Input.GetAxis("Vertical") < 0) {
PlayAnimation("walkB");
}
else if (Input.GetAxis("Vertical") > 0) {
PlayAnimation("walkF");
}
}
No idea how to add the jumping animation. What I want is to play the jumping animation and freeze it at the end of the animation until the player touches the floor again. However, anything would be a step in the right direction. Right now the script has the right animations for walking.
Comment