Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Sun 20/02/2011 04:03:22

Title: ViewFrame.Speed is read-only...any dirty tricks? **SOLVED**
Post by: Knox on Sun 20/02/2011 04:03:22
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 (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.  :)
Title: Re: ViewFrame.Speed is read-only...any dirty tricks?
Post by: ThreeOhFour on Sun 20/02/2011 09:21:59
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:


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.
Title: Re: ViewFrame.Speed is read-only...any dirty tricks? **SOLVED**
Post by: Knox on Sun 20/02/2011 20:05:44
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!