MBHunter88 / -techtonica-assignments

0 stars 3 forks source link

Health and Happiness Values Exceed Maximum Limit of 100 #13

Open MBHunter88 opened 2 months ago

MBHunter88 commented 2 months ago

Description: A bug in the js-game where the health and happiness values can exceed the maximum limit of 100. The game should cap these values at 100 to maintain balance and prevent unrealistic stats for the pet.

Steps to Reproduce: Continuously perform actions that increase the pet's health or happiness (e.g., feeding, playing). Observe that the health and happiness values can exceed 100.

Expected Behavior: The health and happiness values should stop increasing once they reach 100.

Proposed Solution: Implement logic to check the health and happiness values before increasing them. If they are already at 100, do not allow further increments.

Target Code Blocks can be found in the script.js file:

//increase health by clicking on "feed" button and update the display 
    function increaseHealth() {
        if (petHealth < 100 && petHealth != 0) {
            petHealth += 3;
            updateDisplay();
        }
    }
    //increase happiness by clicking on "play" button and update the display 
    function increaseHappiness() {
        if (petHappiness < 100 && petHappiness != 0) {
            petHappiness += 3;
            updateDisplay();
        }
    }
    //increase both stats by cliking on "clean" button and update display 
    function increaseBothbyCleaning() {
        if ((petHappiness < 100 && petHappiness != 0) || (petHealth < 100 && petHealth != 0)) {
            petHappiness += 1;
            petHealth += 1;
            updateDisplay();
        }
    }

Installation Steps Fork then Clone the Repository:

bash/zsh Copy code git@github.com:MBHunter88/-techtonica-assignments.git

Navigate to the Project Directory:

bash/zsh Copy code cd techtonica-projects/js-game/script.js

Install Dependencies:

Run the following command to install all necessary dependencies listed in package.json: bash/zsh Copy code npm install

DiegoDev2 commented 2 months ago

mmm, can you give me the dependencies that I have to install?

MBHunter88 commented 2 months ago

I've updated the issue with the installation steps! Let me know if you have any other questions @CodeDiego15