In my writing game, there is a grid filled with words that are hidden from the user. The goal of the game is to record these words using sound and image. The user pronounces the word by clicking the corresponding letters on the grid.
If the user is mistaken, the word will glow in red. If this happens 3 times, the user will be given the opportunity to go to the next word using the button that will appear during the third incorrect attempt.
At the moment this works, but I just stumbled upon an error with which the wrong score is carried. For example, if a user receives 2 incorrect attempts for one word, then he gets his right, he proceeds to the next. Then it will accept only one incorrect answer to this word so that the user receives the move on option. Basically, I need a way to count reset every time it moves on to the next word.
This code counts the number of failed attempts, and then after 3 makes the button (".minibutton") visible.
var score = { right: 0, wrong: 0, attempts: 0 }; score.wrong++; if (score.wrong == 3) { $(".minibutton").css('visibility', 'visible'); $('.next').css('visibility', 'visible'); }
Help - http://jsfiddle.net/smilburn/7Y7A5/4/ (Sound alert!)
source share