Java Reference
In-Depth Information
}
return option;
}
}
Game.prototype.check = function(answer) {
console.log("check() called");
if(answer === this.question.answer){
update($feedback,"Correct!","correct");
// increase score by 1
this.score++;
update($score,this.score)
} else {
update($feedback,"Wrong!","wrong");
}
this.chooseQuestion();
}
Game.prototype.countDown = function() {
// this is called every second and decreases the time
// decrease time by 1
this.time--;
// update the time displayed
update($timer,this.time);
// the game is over if the timer has reached 0
if(this.time <= 0) {
this.gameOver();
}
}
Game.prototype.gameOver = function() {
console.log("gameOver() invoked");
// inform the player that the game has finished and tell
them how
many points they have scored
update($question,"Game Over, you scored " + this.score +
" points"
 
Search WWH ::




Custom Search