I am working on a game Who Wants to be a Millionaire and I want to show the amount that a USER win either he finished the game or given a wrong answer. Here is the function of wrong answer (which end the game) and I dont know how to add/call amount code into it.
// Executes the proceedure of guessing incorrectly, losing the game.
self.wrongAnswer = function(elm) {
$("#" + elm).slideUp('slow', function() {
startSound('wrongsound', false);
$("#" + elm).css('background', 'red').slideDown('slow', function() {
$("#game").fadeOut('slow', function() {
$("#game-over").html('Game Over!')
$("#game-over").fadeIn('slow');
self.transitioning = false;
});
});
});
}
// Gets the money formatted string of the current won amount of money.
self.formatMoney = function() {
return self.money().money(0, '.', ',');
}
};
Final solution from OPs comments: -
Just add the correct function call in the place you'd like it to appear.
$('#game-over').html("Game Over!<br \>You would've won " + self.formatMoney());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.