Hello. I have a slight problem and I hope its easily remedied. I have a character with two animations that I want to switch between. So say animation A is playing, but at frame 13 something happens and I want to now play animation B starting from frame 14. Please tell me this is possible. :)
Edit: This can occur at any frame, so splitting up the animations at a certain point is not an option.
Quote from: TM on Wed 04/08/2010 18:18:39
Hello. I have a slight problem and I hope its easily remedied. I have a character with two animations that I want to switch between. So say animation A is playing, but at frame 13 something happens and I want to now play animation B starting from frame 14. Please tell me this is possible. :)
Edit: This can occur at any frame, so splitting up the animations at a certain point is not an option.
function repeatedly_execute() {
if ((cEgo.View==A) && (cEgo.Frame==13)) {
cEgo.UnlockView();
cEgo.LockViewFrame(B,cEgo.Loop, 14);
cEgo.Animate(cEgo.Loop,5,eOnce,eBlock,eForwards);//Not sure if you need these one you don't define when you want the animation to play
cEgo.UnlockView();//same as above
}
}
Hm, that doesn't work for me. When I use your code, the Animate command starts loop B at frame 0 again instead of at frame 14.
You can always do this manually. It depends on the circumstances which way to approach this is best.
If the frame at which the view is going to switch is known before the animation starts, you could generate the loop dynamically using an empty loop and the ViewFrame commands.
Otherwise you'd have to manually advance the frame/change the view using a timer, i.e. set a variable to true when you want the animation to start and inside repeatedly_execute, advance the frame if the variable is true and x loops have passed. You can get the frame delay using the ViewFrame command, then add the animation's delay.
Since this process is non-blocking, all that's left to do is change the View during the animation.