The Adventures of Tokk Project Report Raphael Leon 31 may 2014 | Page 9

if (Input.GetKey("a")) { //turns the character around transform.eulerAngles = Vector3(0, 455, 0); if (animation.isPlaying) animation.CrossFade("walk"); else animation.Play("walk"); } else if (Input.GetKeyUp("a")) { animation.CrossFade("idle", 1); } //this is the code end for an animation if (Input.GetKey("w")) { if (animation.isPlaying){ animation.CrossFade("jump"); animation.CrossFadeQueued("idle");} else { animation.Play("jump"); animation.CrossFade("idle", 1); }} if (Input.GetButtonDown("Fire1")) { if (animation.isPlaying) animation.CrossFade("attack"); else animation.Play("attack"); }} This will ensure that an animation is playing at all times such as idle or walking animations. It also ensures that that when animations change into one another (e.g. idle animation into walking) it isn’t jerky but smooth because it has been set so that they fade into one another. Once the scripts had been