Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout update #1

Merged
merged 2 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions zombie-game/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="style.css">
<script src="script.js" defer></script>
<title>Zombie Game</title>
Expand All @@ -24,8 +24,17 @@
</div>
<div id="score">SCORE : 0</div>
</div>

<button id="start-game-btn">START GAME</button>

<section id="start-window">
<h1>RULES</h1>
<div id="rules">
<p>1. You have 3 lives</p>
<p>2. Shoot by clicking on the screen</p>
<p>3. You get 10 points for each zombie killed</p>
<p>4. You lose 5 points if you miss</p>
</div>
<button id="start-game-btn">START GAME</button>
</section>

<div id="ending-hud">
<p>GAME OVER</p>
Expand Down
4 changes: 3 additions & 1 deletion zombie-game/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async function prepareGame() {
let body = document.querySelector("body");
let gunSight = document.getElementById("gunsight");
let startGameButton = document.getElementById("start-game-btn");
let startWindow = document.getElementById("start-window");
let endingHud = document.getElementById("ending-hud");
let restartGameButton = document.getElementById("restart-game-btn");
let heart1 = document.getElementById("heart1");
Expand All @@ -82,8 +83,9 @@ async function prepareGame() {
gunSight.style.display = "block";
body.style.cursor = "none";

startGameButton.style.display = "none";
startGameButton.setAttribute("disabled", "true");

startWindow.style.display = "none";

endingHud.style.display = "none";

Expand Down
83 changes: 78 additions & 5 deletions zombie-game/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
body {
margin: 0;
background-color: black;
min-width: 900px;
min-width: 1000px;
}

#game-board {
Expand Down Expand Up @@ -47,16 +47,43 @@ body {
}

#hud button {
height: 100px;
height: 60px;
width: 300px;
color: white;
font-size: 30px;
border-radius: 40px;
font-size: 20px;
border-radius: 10px;
transition: transform 0.4s;
}

#start-window {
background-color: rgb(242, 242, 242);
border-radius: 10px;
height: 300px;
width: 600px;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
padding: 10px;
margin-top: 200px;
box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.5);
}

#start-window h1 {
font-size: 30px;
color: black;
margin: 10px;
}

#rules p {
font-size: 18px;
color: black;
margin: 10px;
line-height: 1.5;
}

#start-game-btn {
width: max(30%, 200px);
margin-top: max(50vh, 300px);
background-color: green;
}

Expand Down Expand Up @@ -126,6 +153,50 @@ body {
transform-origin: top;
}

@media screen and (max-width: 1200px) {
#heart-container {
width: 350px;
}

.heart {
width: 90px;
}

#score {
font-size: 40px;
}

#top-hud {
padding: 10px;
}

#ending-hud {
font-size: 40px;
margin-top: 60px;
}
}

@media screen and (orientation:landscape) and (max-height: 600px) {
#start-window {
margin-top: 160px;
height: 180px;
width: 400px;
}

#start-game-btn {
font-size: 15px;
}

#start-window h1 {
font-size: 20px;
}

#rules p {
font-size: 15px;
line-height: 1;
}
}

@keyframes walk {
0% {
background-position: 2000px;
Expand All @@ -145,3 +216,5 @@ body {
transform: translateX(-350px);
}
}