Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: BlueAngel on Sun 03/07/2011 14:10:26

Title: [SOLVED] animating object change view
Post by: BlueAngel on Sun 03/07/2011 14:10:26
Ok I have searched for the answer to this simple question but in vain, please help.
I want an object to move to a point while animating, then stop. After a cut screen (not done yet), I want the object to change view and move off screen.
But I can’t get the object to change view. It starts in view 0 or in view 1.
What do I wrong?


function room_AfterFadeIn()
{
 Wait(10);
 oHorseHouse.SetView(8, 1, 1);
 oHorseHouse.Animate(1, 10, eOnce, eNoBlock, eForwards);
 
 oHorseHouse.Move(334, 343, 1, eNoBlock, eAnywhere);
 //object[1].StopAnimating();
 //oHorseHouse.SetView(8, 0, 1);
 oHorseHouse.Animate(0, 10, eRepeat, eNoBlock, eForwards);
 //oHorseHouse.Move(66, 329, 1, eNoBlock, eAnywhere);
}


As you see I have tried different things but to no success

If I put a stop animate or change view it doesn’t animate at all or change view at once.
I thought the script happens line after line?  ???
Title: Re: animating object change view
Post by: Khris on Sun 03/07/2011 14:43:13
You're using eNoBlock which causes the next line to be executed immediately.

Use eBlock instead.
Title: Re: animating object change view
Post by: BlueAngel on Mon 04/07/2011 06:59:45
But if I use eBlock it dont animate while moving?
Should I use a character instead?
Title: Re: animating object change view
Post by: barefoot on Mon 04/07/2011 07:49:15
Hi

eNoblock for the animation and run eBlock for the move. Plus you have it to only animate ONCE, so it may well be much shorter animation than required move distance you have.





Title: Re: animating object change view
Post by: monkey0506 on Mon 04/07/2011 17:41:31
function room_AfterFadeIn()
{
  Wait(10);
  oHorseHouse.SetView(8, 1, 1);
  oHorseHouse.Animate(1, 10, eRepeat, eNoBlock); // note that you don't HAVE to supply ALL of the parameters
  oHorseHouse.Move(334, 343, 1, eBlock, eAnywhere);
  oHorseHouse.Animate(0, 10, eRepeat, eNoBlock);
}


The RepeatStyle, BlockingStyle, and Direction parameters of Object.Animate are all optional, so you don't have to pass them every time. The default for BlockingStyle is eBlock though, so you have to pass the RepeatStyle parameter to get to the BlockingStyle parameter and set it to eNoBlock. For Move the default BlockingStyle is eNoBlock and the default WalkWhere is eWalkableAreas, so you have to specify both of those to get the desired results.

So the above will now animate the oHorseHouse object repeatedly in Loop 1 until the movement is finished, then it will animate repeatedly in Loop 0, and allow the game to continue.
Title: Re: [SOLVED] animating object change view
Post by: BlueAngel on Tue 05/07/2011 06:49:57
Thank you all, it worked beautifully!  :D