diff --git a/game.js b/game.js index 15ae1d3..ad678be 100644 --- a/game.js +++ b/game.js @@ -116,7 +116,11 @@ function feed() { textOne.innerText = `${cat.name} is full.`; textTwo.innerText = "Please try another action."; } - } else noActions; + } else { + textOne.innerText = "Oh dear, you have run out of actions."; + textTwo.innerText = "All you can do is end the day and see whether you've done enough to improve your bond with your cat. Press 'End Day' below."; + end.classList.remove('hidden'); + } //refactor this statement into a function perhaps? As it's repeated for all functions } function pet() { @@ -134,7 +138,11 @@ function pet() { textOne.innerText = `${cat.name} is as happy as they can be.`; textTwo.innerText = "Please try another action."; } - } else noActions; + } else { + textOne.innerText = "Oh dear, you have run out of actions."; + textTwo.innerText = `All you can do is end the day and see whether you've done enough to improve your bond with ${cat.name}. Press 'End Day' below.`; + end.classList.remove('hidden'); + } } function play() { @@ -150,7 +158,11 @@ function play() { textOne.innerText = `${cat.name} has played to their heart's content and is now exhausted.`; textTwo.innerText = "Please try another action."; } - } else noActions; + } else { + textOne.innerText = "Oh dear, you have run out of actions."; + textTwo.innerText = "All you can do is end the day and see whether you've done enough to improve your bond with your cat. Press 'End Day' below."; + end.classList.remove('hidden'); + } } function care() { // Not really sure how this function should work or if it's needed? @@ -166,7 +178,11 @@ function care() { // Not really sure how this function should work or if it's ne textOne.innerText = `${cat.name} has enough energy and they don't require any care.`; textTwo.innerText = "Please try another action."; } - } else noActions; + } else { + textOne.innerText = "Oh dear, you have run out of actions."; + textTwo.innerText = "All you can do is end the day and see whether you've done enough to improve your bond with your cat. Press 'End Day' below."; + end.classList.remove('hidden'); + } } function endDay() { @@ -192,8 +208,8 @@ function winGame() { } -function noActions() { - textOne.innerText = "Oh dear, you have run out of actions."; - textTwo.innerText = "All you can do is end the day and see whether you've done enough to improve your bond with your cat. Press 'End Day' below."; - end.classList.remove('hidden'); -} \ No newline at end of file +// function noActions() { +// textOne.innerText = "Oh dear, you have run out of actions."; +// textTwo.innerText = "All you can do is end the day and see whether you've done enough to improve your bond with your cat. Press 'End Day' below."; +// end.classList.remove('hidden'); +// } \ No newline at end of file