我正在制作一个想要成为百万富翁的游戏,我想展示一个数量 USER赢了他完成比赛或给出错误的答案。这是错误答案的功能(游戏结束),我不知道如何添加/调用金额代码。
// 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, '.', ',');
}
};
答案 0 :(得分:1)
OP评论的最终解决方案: -
只需在您希望显示的位置添加正确的函数调用。
$('#game-over').html("Game Over!<br \>You would've won " + self.formatMoney());