Animation view repeat

Started by Flyman, Tue 17/01/2012 15:05:45

Previous topic - Next topic

Flyman

Hi..
I've created a flying ufo with led (on,off)";
If the object move,  all work properly, the problem... if a use eRepeat..."for my wiev", nothing appear!! What is wrong in my script??

object[0].SetView(47, 0)
object[0].SetPosition(60, -10);
object[0].Animate(0, 2, eRepeat); // eRepeat if insert...not work!!
object[0].Move(49, 129, 1, eBlock, eAnywhere);

Please help

NickyNyce

#1
I believe this should be in the Beginners forum

I have this in my game, which is a UFO spinning and flying across the screen....might help

 object[0].SetView(VSpin);   //Set your objects view, this should be the one of your UFO spinning, you can also just type the # of the view too.
 object[0].Animate(0, 2, eRepeat, eNoBlock, eForwards);   //This will animate your object to spin with eNoBlock so you can move the object with the move command
 object[0].Move(900, 156, 3, eBlock, eAnywhere);  //This will move your object across the screen


Khris

The default blocking for Object.Animate is eBlock, so if you call it with just eRepeat, what you actually call is:

Code: ags
  object[0].Animate(0, 2, eRepeat, eBlock, eForwards);


A repeating animation that blocks the game will pretty much make your game appear to hang. Since the object is still off-screen at this point, you don't see anything.

Use:
Code: ags
  object[0].Animate(0, 2, eRepeat, eNoBlock);


Also, why are you using object[0]? Is this code in the global script? Because in room scripts, you can use the actual object name. So if you named it oUfo, you could do oUfo.Animate(...); which is much more readable.
I'd really be interested where you got object[0] from since several newbies have used this without a good reason but it's a sort of "advanced" way and usually not well-known among beginners.

Flyman

I've add "eNoBlock" in my script and now all work, great!! Thanks!!

SMF spam blocked by CleanTalk