- Home /
firebar goes down and stops
Hi, I've made a code in which I want a line to change the width if I fly... in this case it is called jump. I've made this with an animation. The fire bar has an animation in which the width changes to be smaller, like a health bar... here's the code:
if(...){
firebar.animation.Play("firebardown);
}
if(...){
firebar.animation.Stop("firebardown);
}
but now I've got the problem that the animation starts new if I jump. How can I change it... I want that the width of the fire bar gets smaller... I stop jumping, then the animations stops... then I start jumping and the animations goes on and doesn't start new like it does in my code.... please help. If some people don't understand this description then just ask me for a description that is more detail.
SRY for my english...
I think you need something like an "animation.Pause" function, so you can resume your animation at the point it was paused ins$$anonymous$$d of having it restarted from beginning (Stop rewinds the animation automatically). Unfortunately I've not found anything like this in documentation - hope some animation expert can help you...
Answer by almo · May 31, 2011 at 01:53 PM
AnimationState.speed = 0 should stop an animation, then setting AnimationState.speed = 1 should resume it.
So I think you can do firebar.animation.speed = 0 to stop, and firebar.animation.speed = 1 to resume.
I'm not an expert on the Unity animation system, but this is what it looks like you should try.
thx very much thats exactly what I was searching... THAN$$anonymous$$S!!!!!!!!!!!! You almost solved 10 problemes or so...
THX!
well now I want that the firebar loads again with speed = -1.0; but when it's finished with the animation... it goes on and on invisible, so when I fly the next time, it takes a while until he is at frame one again. and again if u don't understand this just ask...
I'm not sure what you're looking for with this one. If my answer worked, please click the checkmark over by the thumbs to accept it, then enter a new question for the new problem.