[SOLVED] animating object change view

Started by BlueAngel, Sun 03/07/2011 14:10:26

Previous topic - Next topic

BlueAngel

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?

Code: ags

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?  ???

Khris

You're using eNoBlock which causes the next line to be executed immediately.

Use eBlock instead.

BlueAngel

But if I use eBlock it dont animate while moving?
Should I use a character instead?

barefoot

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.





I May Not Be Perfect but I Have A Big Heart ..

monkey0506

Code: ags
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.


SMF spam blocked by CleanTalk