Hi Everyone.
Right. I am doing very well with my game although still a long way to go. But I have a small annoying problem.
In one of my rooms I have a piece of machinery that moves up and down. For this I use-
object[0].SetView(7);
object[0].Animate(0,5,eRepeat,eNoBlock,eForwards);
Now some things happen and the machine grinds to a halt. For this I use-
if (object[0].Animating) {
object[0].StopAnimating();
}
This is my question.
Is there a way that I can get the animation to stop on a specific frame? (At the moment it stops on whatever frame it wants).
Also, just out of interest, is there a way to start an animation on a specific frame?
Any help would be wonderful.
Thankyou.
Jay.
Try something like (untested):
while (object[0].Animating&&object[0].Frame!=4) {
Wait(1);
}
object[0].StopAnimating();
Since it seems you don't want a blocking animation, you could put this in the repeatedly_execute function:
if (object[0].Frame == 4) object[0].StopAnimating();
And you can set the view, loop, and frame of the object right before you animate it:
object[0].SetView(7, 0, 5);
object[0].Animate(0, 5, eRepeat, eNoBlock, eForwards);
The problem is, he wants to stop the animation when something happens (like clicking at a hotspot, etc.). So, if he needs it to be non-blocking, he needs more than just a line in the repeatedly_execute function.
Hi Guys.
Sorry it took a while to reply. Been having some probs getting on here today.
Anyway I am pleased to report that Gilbots untested script works a treat.
My animation now stops exactly where I need it to.
My thanks also to skuttleman.
I haven't tried your script just yet but I think it will help when it comes time to start my animation again.
You see my machine (in the game) gets moved to another room so I will want it to animate from the frame it stopped at in the previous room.
From there it will just keep looping as there will be nothing else the player can do with it.
Once again thankyou both very much.
Jay.