Skip to content

Commit

Permalink
Reorganizing CSS into multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bopally committed Oct 17, 2024
1 parent 7ecb754 commit 5a08629
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 264 deletions.
Binary file modified Images/.DS_Store
Binary file not shown.
Binary file modified Images/feu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cookie Game</title>
<link rel="stylesheet" href="./style/style.css" />
<link rel="stylesheet" href="./style/main-style.css" />
<link rel="stylesheet" href="./style/instructions.css">
<link rel="stylesheet" href="./style/recipe-ingredients.css">
<link rel="stylesheet" href="./style/status-indicators.css">
<link rel="icon" href="./Images/cookie-player.png" type="image/x-icon">
</head>

Expand Down
1 change: 0 additions & 1 deletion javascript/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ document.addEventListener("DOMContentLoaded", () => {
instructionsMessage.style.display = "none";
startGame();
};
playBackgroundMusic();
});

// Function LifeCounter
Expand Down
42 changes: 42 additions & 0 deletions style/instructions.css
Original file line number Diff line number Diff line change
@@ -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;
}
78 changes: 78 additions & 0 deletions style/main-style.css
Original file line number Diff line number Diff line change
@@ -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);
}
56 changes: 56 additions & 0 deletions style/recipe-ingredients.css
Original file line number Diff line number Diff line change
@@ -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;
}
83 changes: 83 additions & 0 deletions style/status-indicators.css
Original file line number Diff line number Diff line change
@@ -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;
}
Loading

0 comments on commit 5a08629

Please sign in to comment.