punish all on timeout w/o buzzer press

This commit is contained in:
Astro 2010-11-30 21:07:15 +01:00
parent bdeb456d0d
commit 888b1f3c08
1 changed files with 25 additions and 19 deletions

44
quiz.js
View File

@ -220,35 +220,41 @@ function switchToGame() {
var isRight = choice !== null && q.answers[choice].right === true;
if (isRight) {
playerScores[activePlayer] += q.tier;
updateScores();
} else {
playerScores[activePlayer] -= q.tier;
updateScores();
if (choice !== null)
// Hilight the wrong choice
answerEl.addClass('wrong');
}
// Hilight all right choices
var i = 0;
q.answers.forEach(function(answer) {
if (answer.right === true)
$('#answer' + i).addClass('right');
i++;
});
keyHandler = function(key) {
if (key === " ") {
// next question:
currentQuestion++;
$('#game').fadeOut(500, function() {
switchToScoreboard();
});
}
};
} else {
/* TODO: punish all */
/* no player wanted to answer, punish all */
for(var i = 0; i < playerNames.length; i++) {
if (playerNames[i]) {
playerScores[i] -= q.tier;
}
}
}
updateScores();
// Hilight all right choices
var i = 0;
q.answers.forEach(function(answer) {
if (answer.right === true)
$('#answer' + i).addClass('right');
i++;
});
keyHandler = function(key) {
if (key === " ") {
// next question:
currentQuestion++;
$('#game').fadeOut(500, function() {
switchToScoreboard();
});
}
};
};
timer.set(TIMER_QUESTION, switchToAnswer);