I am using collisions to detect if the character is on the ground or in the air. Im using a variable which is either true or false depending on whether the character is touching the ground or not. Now the jumping up animation is playing fine but when the character touches the ground the landing animation keeps on playing since I have set the landing animation to play when the character touches the ground. Since the character is touching the ground, the landing animation will not stop playing. I have a limited knowledge of programing so I cannot think of anything which I can use or search for on google.
The script is something like this
var grounded : boolean = false;
function update ()
{
if (!grounded)
animation.crossfade ("Jump")
else
animation.crossfade ("Land")
}
Here is an example of what I want to do and I have also downloaded the source files but I dont understand how this guy is doing this.
Yes I have had a look at this but this isnt what I want. This only has one animation which consists of jumping up and jumping down, no matter how high you are from the ground or if you touching the ground or not, the jumping animation will play since its all a single animation and plays straight after the first one.