End of Animation as a trigger?

hi there just wondering is there a way so that when an animation has played once I can have an event happen.

for example if I have two jumping animations, one of a character rising then falling.

while character animation jump up is playing, y = y + 1. Then when that animation has ended play animation jump decend, and while that is playing y = y - 1.

Don’t get misguided I already have a jump mechanic and its not what im after. I only know how to play animations in loops and I have no way of knowing how to detect if the animation has ended in code which is what im after.

Have you tried AnimationEvent’s yet?

In this particular event you woudn’t want that to happen. You would want to know when the character has reached or passed an apex of the jump. So you start out when the player presses the Jump button and play the animation “Jump”. This is a loopforever animation. It will reach teh end of the animation and then stop and wait until the apex is reached.

As soon as the apex is reached then you swap your animation to falling. (as a matter of fact any time that your character is not grounded and is not moving “up” then you are falling. It is a looping animation that depicts your character as falling downward.

If you now wish, as soon as your character becomes grounded, you could do several things. Continue walking or running, blend a landing animation into your walk/run. You could check to see the downward velocity that he attained and if it is over a certain amount do a landing, rolling or hurt animation. It is really up to you and what you want to do with your game.

thnx, im looking at animation events now but so far it seems a little over complex.

I can’t say what specific scenario im using it for because I intend to use it for a wide variety of things. Like say my character is attacking and so an attack animation is being played, say for instance the swing of his sword. so when the animation starts it will trigger a boolean variable saying the player is attacking, so that the enemies will react to it and when the animation ends it triggers the boolean value to now return false.

Again say the player intends to do a combo, so one button is pressed and the character plays the animation of an attack, then when the player pushes the button again while attack animation is being played, after that animation is finished it will play the next attack in the combo. So its very animation dependent, I want the next attack to be played just after the previous animation to make it look right.

I want it so that when I push a button my character attacks but when I push it again, I want the script to wait till the animation is finished to play the next attack.

so if boolean value is true play other animation after the other animation but I don’t want it cut off that animation.

Also after an animation is finished I want to be able to raise a flag saying so, so that I can change some values.