Hey folks. I'm trying to create a repeating random timer that runs the following code anywhere between 45 to 70 seconds each time.
oIdol.SetView(IDOL_SPARKLE, 0, 0);
oIdol.Animate(0, 1, eOnce, eNoBlock);
I must admit I'm a little clueless on how to approach this.
Cheers,
Sparky.
To get a random value between two values, use, e.g.:
Random(10)+10;
This will return a value between 10 and 20.
Thanks, I already know that. However I have no clue how to incorporate a timer into this which activates the animation of my sprite. I've explained it better above.
Cheers,
Sparky.
function repeatedly_execute(){
if(IsTimerExpired(10)==1 && oIdol.Animating==false){
oIdol.SetView(IDOL_SPARKLE, 0, 0);
oIdol.Animate(0, 1, eOnce, eNoBlock);
SetTimer(10,0);
}
if(IsTimerExpired(10)==0 && oIdol.Animating==false)SetTimer(10,Random(25)+45);
}
This should suffice:
function repeatedly_execute() {
if (IsTimerExpired(10)) {
oIdol.SetView(IDOL_SPARKLE, 0, 0);
oIdol.Animate(0, 1, eOnce, eNoBlock);
SetTimer(10,Random(25)+45)
}
}
To start the sequence, set the timer in after_fadein.
Thanks guys, You rock! 8)
Cheers,
Sparky.