I have added a function the start of app.js where i added a function promptUser which I want to be called every time when the health bars gets less then zero and the game is reset.
But on reset I am not getting prompt - Any idea or help?
let chosenMaxLife; let currentMonsterHealth;
let currentPlayerHealth;
let hasBonusLife = true;
function promptUser() {
const enteredValue = prompt('Maximum life of you and Monster is', '100');
chosenMaxLife = parseInt(enteredValue);
if (isNaN(enteredValue)) {
chosenMaxLife = 100;
}
currentMonsterHealth = chosenMaxLife;
currentPlayerHealth = chosenMaxLife;
adjustHealthBars(chosenMaxLife);
resetGameAgain();
}
attackBtn.addEventListener('click', attackHandler);
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment