Skip to content

Commit

Permalink
Solved issue with ingredients images
Browse files Browse the repository at this point in the history
  • Loading branch information
Bopally committed Oct 17, 2024
1 parent e53b117 commit ead0b29
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions javascript/recipe-ingredients.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function updateRecipeDisplay() {
const listItem = document.createElement("li");
listItem.className = "ingredient-recipe";
const imgElement = document.createElement("img");
imgElement.src = `../Images/${ingredient}.png`;
imgElement.src = `./Images/${ingredient}.png`;
imgElement.alt = ingredient;
imgElement.className = "ingredient-img";

Expand All @@ -83,19 +83,16 @@ function collectIngredient(ingredient) {
collectedIngredients[ingredient.type]++;
updateRecipeDisplay();
} else {
console.log(`Unnecessary ingredient collected: ${ingredient.type}`);
lifeCounter--;
updateHearts(lifeCounter);
}

if (lifeCounter === 0) {
console.log("Game Over");
gameOverMessage.style.display = "block";
clearIntervals();
}

if (isRecipeComplete()) {
console.log("Recipe Complete! You win!");
victoryMessage.style.display = "block";
clearIntervals();
}
Expand Down

0 comments on commit ead0b29

Please sign in to comment.