September 2010
Beginner
384 pages
8h 49m
English
The trouble is that we're telling the character to play his "catch" animation, but it's not happening. We see, at best, the first frame of that animation, and then it's interrupted by either the "idle" or "step" animation.
Luckily, we can add a condition to the script to prevent these glory-hog animations from playing if we're trying to catch a beer stein. Dip back into your CharacterScript and make these changes:
if(lastX != transform.position.x) {
if(!isMoving) {
isMoving = true;
if(!animation.IsPlaying("catch")){
animation.Play("step");
}
}
}
else {
if(isMoving) {
isMoving = false;
if(!animation.IsPlaying("catch")) {
animation.Play("idle");
}
}
}
By wrapping the animation.Play calls in these animation.isPlaying ...
Read now
Unlock full access