Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: xenogia on Mon 25/01/2010 11:20:44

Title: Looping animations backwards and forwards
Post by: xenogia on Mon 25/01/2010 11:20:44
I am trying to loop an animation backwards and forwards not being blocked (i don't want to add the reverse frames in the view as there are like 50 frames per view)

I put the following in the room code, but it doesn't seem to register.  Any ideas why?


function repeatedly_execute_always()
{
 
  if (oCutscene.Frame == 216) oCutscene.Animate (2, 3, eOnce, eNoBlock, eForwards);
  if (oCutscene.Frame == 479) oCutscene.Animate (2, 3, eOnce, eNoBlock, eBackwards);
  if (oCutscene.Frame == 480) oCutscene.Animate (3, 3, eOnce, eNoBlock, eForwards);
  if (oCutscene.Frame == 585) oCutscene.Animate (3, 3, eOnce, eNoBlock, eBackwards);
  if (oCutscene.Frame == 586) oCutscene.Animate (4, 3, eOnce, eNoBlock, eForwards);
  if (oCutscene.Frame == 656) oCutscene.Animate (4, 3, eOnce, eNoBlock, eBackwards);
}
Title: Re: Looping animations backwards and forwards
Post by: Khris on Mon 25/01/2010 12:20:49
If you animate something using eNoBlock, the subsequent command gets executed immediately afterwards.
Thus, only the very last command will actually do something.
But, since this is inside rep_ex_always, all lines are called 40 times per second.

The animation doesn't get a chance to actually begin.

You can either use Timers (since you know how long each animation is going to take) or use conditions:
  if (!oCutscene.Animating && oCutscene.Loop == L && oCutscene.Frame == F) oCutscene.Animate(...);
For L and F, put the loop and last frame of the previous animation.
Title: Re: Looping animations backwards and forwards
Post by: Marion on Fri 10/05/2019 14:39:57
Hello ! Sorry for uping this old topic but I am interested : is there today a way to play animation forwards then backwards when it's finished, in an automatic way (for Idle Views and Speech Views, for example) ? Because it's very long to add the reverse frames manually when you have many views and many frames ! Thank you :)
Title: Re: Looping animations backwards and forwards
Post by: Marion on Fri 17/05/2019 14:19:55
That's okay, I found out by right-clicking on the sprites and choose the "assign to view" option :)