Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Monsieur OUXX on Tue 27/10/2015 16:52:46

Title: How to sync View,Loop,Frame of two characters?
Post by: Monsieur OUXX on Tue 27/10/2015 16:52:46
so I'm trying to animate two different characters simultaneously -- so that Character #2 is exactly in the same animation state as Character #1.
But Character #2 is always one frame late despite getting the ViewFrame from Game.GetViewFrame(c1.View, c1.Loop, c1.Frame).

I know I ran in the problem in the past and I can't remember how I solved it, if I ever solved it.

Isn't there a simple way of doing this now that there is the new repeatedly_execute_late? (or what was it called? _after? I forgot its damn name and I can't seem to find it on the forums, like every time I search it)
Title: Re: How to sync View,Loop,Frame of two characters?
Post by: Kumpel on Tue 27/10/2015 17:26:53
There is a new command besides _always?

Could you show us your frame delay in a gif or some YTvid?

If this is just some animation without changing the positions of the characters, i'd say you put an object(or character?) in front of the two characters which view includes the two sprites of the animation as one and make the two characters transparent at that time.





Title: Re: How to sync View,Loop,Frame of two characters?
Post by: Snarky on Tue 27/10/2015 17:37:08
Quote from: Monsieur OUXX on Tue 27/10/2015 16:52:46
Isn't there a simple way of doing this now that there is the new repeatedly_execute_late?

Yes: Use late_repeatedly_execute_always() (which is what the function is called)
Title: Re: How to sync View,Loop,Frame of two characters?
Post by: Monsieur OUXX on Tue 27/10/2015 17:40:47
Quote from: Kumpel on Tue 27/10/2015 17:26:53
There is a new command besides _always?
Yes, there is.

Quote from: Kumpel on Tue 27/10/2015 17:26:53
Could you show us your frame delay in a gif or some YTvid?
No, but it's very simple, really. If you use Game.GetViewFrame(c1.View, c1.Loop, c1.Frame) and then get the .Graphic of the frame, you'll see the frame that was the previous frame of the one currently displayed on-screen.

Quote from: Kumpel on Tue 27/10/2015 17:26:53
If this is just some animation without changing the positions of the characters, i'd say you put an object(or character?) in front of the two characters which view includes the two sprites of the animation as one and make the two characters transparent at that time.
No, there will be a lot of post-processing involved. However you're overthinking it. I know that there is a catch when manipulating the current data of a character, but I can't remember where it lies.

Quote from: Snarky on Tue 27/10/2015 17:37:08
late_repeatedly_execute_always()
Thanks, I'll see if using this fixes my issue!
Title: Re: How to sync View,Loop,Frame of two characters?
Post by: Monsieur OUXX on Tue 27/10/2015 17:45:35
Actually, hold on. The frame in the "mirror" character is one frame ahead of the original character's frame. So it might be a stupid mistake in my script after all.
Title: Re: How to sync View,Loop,Frame of two characters?
Post by: Snarky on Tue 27/10/2015 18:12:23
BTW, if you do need to use it, I'm not sure whether this function is included in the 3.4 builds, and for 3.3 you need a special patch.
Title: Re: How to sync View,Loop,Frame of two characters?
Post by: Khris on Tue 27/10/2015 20:15:03
Unless the view changes all the time, you can simply do
  c2.Loop = c1.Loop;
  c2.Frame = c1.Frame;
Title: Re: How to sync View,Loop,Frame of two characters?
Post by: Monsieur OUXX on Wed 28/10/2015 08:17:08
Quote from: Khris on Tue 27/10/2015 20:15:03
Unless the view changes all the time, you can simply do
  c2.Loop = c1.Loop;
  c2.Frame = c1.Frame;


That's what I'm doing, so that means it's definitely an issue in my script.