diff --git a/Images/.DS_Store b/Images/.DS_Store index 16e06f0..7223983 100644 Binary files a/Images/.DS_Store and b/Images/.DS_Store differ diff --git a/Images/feu.png b/Images/feu.png index 34dc999..12aeb18 100644 Binary files a/Images/feu.png and b/Images/feu.png differ diff --git a/README.md b/README.md index e802b32..048b076 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Cookie Game is built with web technologies (html,css, js) ## How to play As a player, you will have to move your cookie to left and right to collect the elements to make a cookie receipe! -Be carreful, some obstacle will come from the sky and you have to avoid them to not lose a life. Collect all elements to make the receipe! +Be carreful, some obstacle will come from the sky and you have to avoid them to not lose a life. Collect all elements to make the recipe! ## Demo diff --git a/index.html b/index.html index c0f6596..32cbea9 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,10 @@ Cookie Game - + + + + diff --git a/javascript/main.js b/javascript/main.js index f239841..187218a 100644 --- a/javascript/main.js +++ b/javascript/main.js @@ -267,7 +267,6 @@ document.addEventListener("DOMContentLoaded", () => { instructionsMessage.style.display = "none"; startGame(); }; - playBackgroundMusic(); }); // Function LifeCounter diff --git a/style/instructions.css b/style/instructions.css new file mode 100644 index 0000000..8f29a55 --- /dev/null +++ b/style/instructions.css @@ -0,0 +1,42 @@ +/* Instructions Style */ +#instructions-message { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + color: rgb(221, 167, 112); + background-color: rgb(127, 57, 18); + opacity: 0.7; + padding: 80px; + padding-bottom: 0px; + border-radius: 92% 92% 8% 8%; + font-size: 20px; + text-align: center; + max-width: 600px; + font-family: "Pacifico", cursive; +} + +#instructions-message img { + position: relative; + width: 100px; + height: 100px; + margin-top: 20px; + display: block; + margin-left: auto; + margin-right: auto; +} + +#start-game-button { + background-color: rgb(221, 167, 112); + color: rgb(127, 57, 18); + border: none; + padding: 15px 32px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; + border-radius: 12px; + font-family: "Pacifico", cursive; +} diff --git a/style/main-style.css b/style/main-style.css new file mode 100644 index 0000000..aa50f0a --- /dev/null +++ b/style/main-style.css @@ -0,0 +1,78 @@ +/* Main Style */ + +@import url("https://fonts.googleapis.com/css2?family=Pacifico&display=swap"); + +body { + background-image: url(../Images/kitchen-backgroung.jpg); + background-size: auto; + background-position: center; + height: 100%; + margin: 0; + display: flex; + justify-content: center; + align-items: center; +} + +#board { + height: 750px; + width: 800px; + border: 8px double rgb(127, 57, 18); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); + position: relative; + overflow: hidden; + border-radius: 92% 92% 8% 8%; +} + +#player { + background-image: url("../Images/cookie-player.png"); + background-size: cover; + width: 80px; + height: 80px; + position: absolute; + transition: left 0.3s ease; +} + +.obstacle { + background-image: url("../Images/feu.png"); + background-size: cover; +} + +/* End Game Style */ +#game-over-message, +#victory-message { + display: none; + align-items: center; + justify-content: center; + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 30px; + color: rgb(221, 167, 112); + text-align: center; + background-color: rgb(127, 57, 18); + padding: 25px; + padding-bottom: 35px; + border-radius: 10px; + font-family: "Pacifico", cursive; + opacity: 0.9; +} + +#game-over-icon, +#victory-icon { + width: 60px; + height: 60px; + margin-bottom: -20px; + padding-top: 20px; +} + +.start-again-button { + margin-top: 15px; + padding: 15px 20px; + font-size: 15px; + cursor: pointer; + font-family: "Pacifico", cursive; + border-radius: 20px; + background-color: rgb(221, 167, 112); + color: rgb(127, 57, 18); +} diff --git a/style/recipe-ingredients.css b/style/recipe-ingredients.css new file mode 100644 index 0000000..42629d6 --- /dev/null +++ b/style/recipe-ingredients.css @@ -0,0 +1,56 @@ +/* Ingredients */ +.ingredient { + position: absolute; + width: 50px; + height: 50px; +} + +.ingredient.flour { + background-image: url("../Images/flour.png"); + background-size: cover; +} + +.ingredient.milk { + background-image: url("../Images/milk.png"); + background-size: cover; +} + +.ingredient.egg { + background-image: url("../Images/egg.png"); + background-size: cover; +} + +.ingredient.chocolate { + background-image: url("../Images/chocolate.png"); + background-size: cover; +} + +/* Recipe */ +#recipe-display { + position: fixed; + top: 10px; + right: 100px; +} + +#recipe-instructions { + font-size: 20px; + color: rgb(127, 57, 18); + margin-bottom: 10px; + font-family: "Pacifico", cursive; + text-align: center; +} + +#recipe-list { + list-style-type: none; + padding: 10; + margin: 0; +} +.ingredient-img { + width: 50px; + height: 50px; + opacity: 0.3; +} + +.collected { + opacity: 1; +} diff --git a/style/status-indicators.css b/style/status-indicators.css new file mode 100644 index 0000000..70f1972 --- /dev/null +++ b/style/status-indicators.css @@ -0,0 +1,83 @@ +/* Time Counter */ +#timer { + display: flex; + align-items: center; + font-size: 20px; + color: rgb(127, 57, 18); + margin-top: 10px; + margin-left: 5px; +} + +#timer-icon { + width: 40px; + height: 40px; + margin-right: 8px; +} + +#time-counter { + position: fixed; + top: 50%; + right: 10px; + font-size: 20px; + padding: 10px; + text-align: center; +} + +#time-text, +#timer-counter { + font-family: "Pacifico", cursive; +} + +/* Life Counter */ +#hearts { + display: flex; + align-items: center; +} + +#hearts img { + width: 50px; + height: 50px; + margin-right: 5px; +} + +#life-counter { + position: fixed; + top: 10px; + left: 10px; + margin-top: 20px; +} + +/* Shield */ +#shield { + position: absolute; + width: 70px; + height: 70px; + background-image: url("../Images/shield.png"); + background-size: cover; + opacity: 0.6; + display: none; + pointer-events: none; +} + +#shield-indicator { + display: flex; + align-items: center; + font-size: 20px; + color: green; /* shield available */ + font-weight: bold; + margin-top: 50px; + font-family: "Pacifico", cursive; +} + +#shield-indicator img { + width: 50px; + height: 50px; + margin-right: 5px; +} +#shield-indicator.unavailable { + color: gray; /* shield availble */ +} + +#shield-indicator.unavailable img { + opacity: 0.3; +} diff --git a/style/style.css b/style/style.css deleted file mode 100644 index 7a67433..0000000 --- a/style/style.css +++ /dev/null @@ -1,261 +0,0 @@ -/* Main Style */ - -@import url("https://fonts.googleapis.com/css2?family=Pacifico&display=swap"); - -body { - background-image: url(../Images/kitchen-backgroung.jpg); - background-size: auto; - background-position: center; - height: 100%; - margin: 0; - display: flex; - justify-content: center; - align-items: center; -} - -#board { - height: 800px; - width: 800px; - border: 8px double rgb(127, 57, 18); - box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); - position: relative; - overflow: hidden; - border-radius: 92% 92% 8% 8%; -} - -#player { - background-image: url("../Images/cookie-player.png"); - background-size: cover; - width: 80px; - height: 80px; - position: absolute; - transition: left 0.3s ease; -} - -.obstacle { - background-image: url("../Images/feu.png"); - background-size: cover; -} - -/* Recipe */ -#recipe-display { - position: fixed; - top: 10px; - right: 100px; -} - -#recipe-instructions { - font-size: 20px; - color: rgb(127, 57, 18); - margin-bottom: 10px; - font-family: "Pacifico", cursive; - text-align: center; -} - -#recipe-list { - list-style-type: none; - padding: 10; - margin: 0; -} -.ingredient-img { - width: 50px; - height: 50px; - opacity: 0.3; -} - -.collected { - opacity: 1; -} - -/* Time Counter */ -#timer { - display: flex; - align-items: center; - font-size: 20px; - color: rgb(127, 57, 18); - margin-top: 10px; - margin-left: 5px; -} - -#timer-icon { - width: 40px; - height: 40px; - margin-right: 8px; -} - -#time-counter { - position: fixed; - top: 50%; - right: 10px; - font-size: 20px; - padding: 10px; - text-align: center; -} - -#time-text, -#timer-counter { - font-family: "Pacifico", cursive; -} - -/* Life Counter */ -#hearts { - display: flex; - align-items: center; -} - -#hearts img { - width: 50px; - height: 50px; - margin-right: 5px; -} - -#life-counter { - position: fixed; - top: 10px; - left: 10px; - margin-top: 20px; -} - -/* Shield */ -#shield { - position: absolute; - width: 70px; - height: 70px; - background-image: url("../Images/shield.png"); - background-size: cover; - opacity: 0.6; - display: none; - pointer-events: none; -} - -#shield-indicator { - display: flex; - align-items: center; - font-size: 20px; - color: green; /* shield available */ - font-weight: bold; - margin-top: 50px; - font-family: "Pacifico", cursive; -} - -#shield-indicator img { - width: 50px; - height: 50px; - margin-right: 5px; -} -#shield-indicator.unavailable { - color: gray; /* shield availble */ -} - -#shield-indicator.unavailable img { - opacity: 0.3; -} - -/* Instructions Style */ -#instructions-message { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - color: rgb(221, 167, 112); - background-color: rgb(127, 57, 18); - opacity: 0.7; - padding: 80px; - margin-bottom: 0; - border-radius: 92% 92% 8% 8%; - font-size: 20px; - text-align: center; - max-width: 600px; - font-family: "Pacifico", cursive; -} - -#start-game-button { - background-color: rgb(221, 167, 112); - color: rgb(127, 57, 18); - border: none; - padding: 15px 32px; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 16px; - margin: 4px 2px; - cursor: pointer; - border-radius: 12px; - font-family: "Pacifico", cursive; -} - -#instructions-message img { - width: 100px; - height: auto; - margin-top: 10px; - display: block; - margin-left: auto; - margin-right: auto; - margin-bottom: 10px; -} -/* Ingredients */ -.ingredient { - position: absolute; - width: 50px; - height: 50px; -} - -.ingredient.flour { - background-image: url("../Images/flour.png"); - background-size: cover; -} - -.ingredient.milk { - background-image: url("../Images/milk.png"); - background-size: cover; -} - -.ingredient.egg { - background-image: url("../Images/egg.png"); - background-size: cover; -} - -.ingredient.chocolate { - background-image: url("../Images/chocolate.png"); - background-size: cover; -} - -/* End Game Style */ -#game-over-message, -#victory-message { - display: none; - align-items: center; - justify-content: center; - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - font-size: 30px; - color: rgb(221, 167, 112); - text-align: center; - background-color: rgb(127, 57, 18); - padding: 25px; - padding-bottom: 35px; - border-radius: 10px; - font-family: "Pacifico", cursive; - opacity: 0.9; -} - -#game-over-icon, -#victory-icon { - width: 60px; - height: 60px; - margin-bottom: -20px; - padding-top: 20px; -} - -.start-again-button { - margin-top: 15px; - padding: 15px 20px; - font-size: 15px; - cursor: pointer; - font-family: "Pacifico", cursive; - border-radius: 20px; - background-color: rgb(221, 167, 112); - color: rgb(127, 57, 18); -}