ViewFrame.Speed is read-only...any dirty tricks? **SOLVED**

Started by Knox, Sun 20/02/2011 04:03:22

Previous topic - Next topic

Knox

Viewframe.Speed is read-only...I checked around and it seems nothing much can be done with this...
(example)
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=42696.0

Is there a "dirty" hack-way I can change this on the fly? Ive got a loop where I'd like the randomize the last frame's delay (without creating more loops if possible).

If this isnt currently possible, I'll add a request to making viewFrame.Speed not read-only if/when the engine goes open-source.  :)
--All that is necessary for evil to triumph is for good men to do nothing.

ThreeOhFour

If you're doing it for the last frame, surely you'd be able to cycle the animation then set a random timer in a rep_ex_always, starting the animation once again once the timer has expired?

Something like:

Code: ags

function repeatedly_execute_always()
{
  if (IsTimerExpired(2))
  {
    oFlag.Animate(1, 3, eOnce, eNoBlock);
    int Flagtime = Random(40) + 40;
    SetTimer(2, Flagtime);
  }
}


That should animate the flag, then run the next animation between one and two seconds later.

Knox

This works nice, I was doing my anims in rep_exec and with this script its much better/compact. I had to write the timer manually (setTimer doesnt work while the game is paused) cause its for a GUI anim...but now I know I can use SetTimer in this way for non-paused anim moments.

Thnx Ben!
--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk