Permalink
Browse files

Lockout for 1s after a wrong answer.

  • Loading branch information...
1 parent 55d8c28 commit 8fba5f4faf95000c6dd484e788b84ea2487e1dda @cscott committed May 7, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 assets/www/index.js
View
@@ -315,7 +315,9 @@ define(['domReady!', './alea', './buzz', './compat', './hammer', './webintent.js
adjustSpeeds(Math.min(correctTime, correctTimeCopy), correctFraction);
};
+ var lockoutID = null;
handleButtonPress = function(color) {
+ if (lockoutID !== null) { return; }
// remove the highest balloon of that color
var i, b, best=null;
for (i=0; i<balloons.length; i++) {
@@ -329,6 +331,9 @@ define(['domReady!', './alea', './buzz', './compat', './hammer', './webintent.js
if (best===null) {
playSoundClip(random.choice(WRONG_SOUNDS));
incorrectAnswer('click.'+color);
+ lockoutID = window.setTimeout(function() {
+ lockoutID = null;
+ }, 1000); // 1s time out after wrong answer
} else {
best.pop();
correctAnswer(color);

0 comments on commit 8fba5f4

Please sign in to comment.