Simons Game question

Simons Game question
0

#1

Hi, my Simons Game is nearly ready. Only thing I need is to lock the ability to push buttons during button flashing sequence. How I can do that? Function responsible for playing the sequence is called blink().


#2

You’ve already got the boolean running as a flag for when it’s running, so you can use that to short circuit the function if it’s true.

function blink() {
   if(running) { return; }
   running = true;
   setTimeout(function() {
    //...
}

You’ll want to change where running gets set to off, though.