Skip to content

Commit

Permalink
reverting noActions function which doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
halimahexe committed Nov 27, 2023
1 parent 8fcb93e commit ab6ed5a
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand All @@ -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?
Expand All @@ -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() {
Expand All @@ -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');
}
// 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');
// }

0 comments on commit ab6ed5a

Please sign in to comment.