HELP ME, please. I am finishing Simon game. Almost everything working fine, but repetition doubles every round. Instead of increasing by 1. My code clean and simple. What am I missing?
I don’t know how this game should play to be honest read your code and I found playSequence function has interval and you increasing var i every 600ms, after first time i=1 but there is nothing on the position 1 in the array randomSequence. So I add “randomSequence.push(Math.floor(Math.random() * 4))” to this function and you can hear something
function playSequence() {
$(".square").css("pointer-events", "none"); //disable colored buttons
$("#screen").text(count);
var i = 0;
var interval = setInterval(function() {
playSound(randomSequence[i]);
highlightBtn(randomSequence[i]);
**randomSequence.push(Math.floor(Math.random() * 4))**
i++;
if (false) {
clearInterval(interval);
$(".square").css("pointer-events", "auto"); //enable colored buttons
}
}, 600);
Some people help me to solve issue. Thank you, anyway.