Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: selmiak on Wed 23/02/2011 01:44:07

Title: 2 animations at the same time possible?
Post by: selmiak on Wed 23/02/2011 01:44:07
I have two objects that I want to animate when an action is started.
It is no problem playing them one after the other, but it seems impossible to play them both at the same time.
I tried adding eNoBlock to the first animation and started the second animation right after the first one but somehow the first one doesn't show at all with the eNoBlock attribute.
Title: Re: 2 animations at the same time possible?
Post by: Gilbert on Wed 23/02/2011 01:52:01
This should work. Can you post the lines of codes you use to animate the objects here, so that we may take a look?
Title: Re: 2 animations at the same time possible?
Post by: monkey0506 on Wed 23/02/2011 02:25:27
If the first animation is not being played when you're calling it with eNoBlock, then I too am inclined to think that there is something else causing your problem. Are you using eOnce or eRepeat as the RepeatStyle? I ask that as a precursor to this question, which is are you letting the animation simply run its course, or are you stopping it manually?

If you are stopping it manually, is it possible that you're stopping one of the animations prematurely? Even if you're running one of the animations with eBlock, it shouldn't prevent other animations running simultaneously.
Title: Re: 2 animations at the same time possible?
Post by: selmiak on Wed 23/02/2011 12:11:02

 ShakeScreenBackground (4, 5, 30);
 oObject1.Visible = true;
 oObject1.SetView(3);
 PlaySound(9);
 oObject1.Animate(0, 5, eOnce, eNoBlock);
 if (oObject2.Visible == true) {
   oObject2.SetView(3);
   oObject2.Animate(3, 5, eOnce, eBlock);
 }


oObject2 is a 'layer' on top of oObject1 and can be put there and only when it is put there is should also animate with the animation of oObject1. Both animations should play only once, so I'm using eOnce, should I try using eRepeat? The help files say just using 0 will do it? After trying


oObject1.Animate(0, 5, 0, eNoBlock);
 if (oObject2.Visible == true) {oObject2.SetView(3);oObject2.Animate(3, 5, 0, eBlock);}

nothing changed

and

oObject1.Animate(0, 5, 0, eBlock);
 if (oObject2.Visible == true) {oObject2.SetView(3);oObject2.Animate(3, 5, 0, eBlock);}

plays them one after the other but not at the same time...

don't know if this is important, but all this code is inside a function that is called from different places with different conditions throughout the script.
edit: when moving the codeblock out of the function and pasting it right where it is called in the script the animations shows with eNoBlock but they are still not starting simultaneously.
Title: Re: 2 animations at the same time possible?
Post by: selmiak on Fri 25/02/2011 21:33:40
anyone got an idea?

I don't even know how to stop animations manually ;)