I've got a non-blocking character animation repeating constantly through a scene. (A whale is swimming.)
I want to trigger the start of another non-blocking animation at a specific point in time, but I want it to be only at the end of a cycle of repeating non-blocking animation so the character doesn't suddenly jump mid-way through the animation cycle. (The whale needs to attack at a specific point in time, but only after we've reached the end of the swim loop.)
Is there a clever way to go about this?
Quicky:
Check: what about if swim frame==[n] next animation (whale) start?
There are a lot of ways to do this.
One way I can think of is like this(not tested):
//Outside of functions in the room's script.
enum WhaleState {
WS_IDLE = 0;
WS_WILLATTACK,
WS_ATTACKING
};
WhaleState cur_ws = WS_IDLE;
//Put the following in wherever the attack command is to be registered.
if (!cur_ws&&(whatever condition to trigger the attack)) cur_ws = WS_WILLATTACK;
//Put the following in repeadedly_execute_always() of the room.
if (cur_ws == WS_WILLATTACK&&cWhale.Frame == 5){ //Replace the 5 to the correct last frame number of the loop.
cur_ws = WS_ATTACKING;
cWhale.LockView(whale_attack_view);
cWhale.Animate(0, 0, eOnce, eNoBlock, eForwards);
} else if (cur_ws == WS_ATTACKING&&!cWhale.Animating){
cur_ws = WS_IDLE;
cWhale.LockView(whale_swim_view);
cWhale.Animate(0, 0, eRepeat, eNoBlock, eForwards);
}
These worked wonderfully. Thank you both!