Ok, Imagine a dodge-ball game where a ball is created every 5 seconds and hurled towards the player , and the player's goal is to avoid it.
Now when the player is hit, it toggles a variable which stops the balls from being created and hurled, towards the player.
Then a 'are you ready?' button pops up, which if clicked would toggle the variable again, and the balls being created every 5 seconds, will resume.
The problem is, Imagine i clicked the 'are you ready' button 1 second after it pops up, then the ball appears 4 seconds later. I click the button 3 seconds after it pops up, the ball is created after 2 seconds. You see where i'm headed.
So if i waited for a long time to click, past 5 seconds. Say i clicked it after 8 seconds,then a ball immediately flies into the screen. This catches the player off guard. How do i prevent this.
Same issue while restarting the layout. If i restart it with just 2 seconds left for a ball to be created, on the restarted layout a ball appears after 2 seconds only. If there was only 0.00009 seconds remaining for a ball to be created, then on the restarted layout a ball appears immediately. Unlike where it takes 5 seconds for a ball to come if i started the layout for the first time.
Anyone have a solution?
Sorry for the essay lol