I am writing a basic widget for a moving platform or obstacle of some kind. I have a function, Motion, that calls a group of other functions. The problem is that they are all called at the same time. How can I make the game wait for ForwardMove() to complete before calling yield and BackwardMove.
In addition, how could I get this to repeat or recur as long as moving == True? I tried a While loop but it caused everything to happen at the same time on every frame.
function Motion(){
if (moving){
yield WaitForSeconds(startpause);
ForwardMove(forwardtime);
yield WaitForSeconds(endpause);
BackwardMove(backwardtime);
}
}