Browse files

Aritmetica: operacao: termina jogo apos numquestions

  • Loading branch information...
1 parent d2b7d42 commit b9f15b122b926c4436defe8c8a683ef7a98ebf7c @felipesanches felipesanches committed Jun 28, 2011
Showing with 20 additions and 20 deletions.
  1. +20 −20 simulador/pensebem.js
View
40 simulador/pensebem.js
@@ -235,25 +235,28 @@ Aritmetica = {
Som.playSong(Songs.Wrong);
}
} else {
- Aritmetica.currentQuestion++;
-
- Som.playSong(Songs.Correct, function() {
- Aritmetica.points += PB.pointsByNumberOfTries(Aritmetica.tries);
- if (Aritmetica.currentQuestion < Aritmetica.numQuestions){
- Aritmetica.advanceQuestion();
- } else {
- PB.delay(10, function(){//pequena pausa de 1 segundo. TODO: medir qual é o tempo correto
- PB.clearDisplay();
- PB.showNumberAtDigit(Aritmetica.points, 7);
- PB.blinkAll();
- Som.playSong(Songs.Winner); // TODO: play it faster!
- PB.delay(50, Aritmetica.reset); //this means 50 ticks, which is 5 seconds TODO: check correct timing
- });
- }
- });
+ Aritmetica.correct();
}
}
},
+ correct: function(){
+ Aritmetica.currentQuestion++;
+
+ Som.playSong(Songs.Correct, function() {
+ Aritmetica.points += PB.pointsByNumberOfTries(Aritmetica.tries);
+ if (Aritmetica.currentQuestion < Aritmetica.numQuestions){
+ Aritmetica.advanceQuestion();
+ } else {
+ PB.delay(10, function(){//pequena pausa de 1 segundo. TODO: medir qual é o tempo correto
+ PB.clearDisplay();
+ PB.showNumberAtDigit(Aritmetica.points, 7);
+ PB.blinkAll();
+ Som.playSong(Songs.Winner); // TODO: play it faster!
+ PB.delay(50, Aritmetica.reset); //this means 50 ticks, which is 5 seconds TODO: check correct timing
+ });
+ }
+ });
+ },
showCorrectAnswer: function() {
//PB.blinkDisplayAFewTimesBeforeResuming(Aritmetica.answer);
if (Aritmetica.showOperator) {
@@ -378,10 +381,7 @@ Operacao = {
Som.playSong(Songs.Wrong);
}
} else {
- Som.playSong(Songs.Correct, function(){
- Aritmetica.points += PB.pointsByNumberOfTries(Aritmetica.tries);
- Aritmetica.advanceQuestion();
- });
+ Aritmetica.correct();
}
break;
default:

0 comments on commit b9f15b1

Please sign in to comment.