javascript - Added a pause function that wont work. Anyone know a solution? -


this question exact duplicate of:

i have added pause function game:

function pausegame() {     if (!gamepaused) {         game = cleartimeout(game);         gamepaused = true;     } else if (gamepaused) {         game = settimeout(drawgame, speed - (level * 50));         gamepaused = false;     } }; 

but reason, wont pause game. can figure out why wont work? game here.

you need set game first time call settimeout(). otherwise when cleartimeout(game), throws error (and doesn't set gamepaused true).


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -