hey, guys, I am using the following program for ‘‘lighting up’’ colors in Simon game but what happens is while the first light goes up after 5 seconds, following lights go up immediately, not after the 5 seconds delay.
sequence = [1,2,3,4,1,2,3,4]; // for testing purpose
function seqLightup() {
for (var i = 0; i < sequence.length; i++) {
switch (sequence[i]) {
case 1:
setTimeout(lightup1, 5000);
break;
case 2:
setTimeout(lightup2, 5000);
break;
case 3:
setTimeout(lightup3, 5000);
break;
case 4:
setTimeout(lightup4, 5000);
}
}
}
whole code is here: https://codepen.io/verv0eren/pen/rjawRO?editors=0010#0