Skip to content

Commit 6b35712

Browse files
committed
Game finished
1 parent 095ea50 commit 6b35712

File tree

2 files changed

+62
-11
lines changed

2 files changed

+62
-11
lines changed

index.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Space Invader Game</title>
7-
<script src="game.js" defer ></script>
7+
<script src="game.js" defer></script>
88
<link rel="stylesheet" type="text/css" href="style.css">
99
</head>
1010
<body>
11-
<canvas></canvas>
12-
<p><span>Score:</span><span>0</span></p>
13-
11+
<div class="game-container">
12+
<p class="score-display">
13+
<span>Score: </span><span id="score">0</span>
14+
</p>
15+
<canvas></canvas>
16+
</div>
1417
</body>
15-
</html>
18+
</html>

style.css

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,57 @@
1-
body{
1+
2+
* {
23
margin: 0;
3-
overflow:hidden;
4+
padding: 0;
5+
box-sizing: border-box;
46
}
5-
p{
6-
position: fixed;
7-
z-index: 10;
7+
8+
html, body {
9+
height: 100%;
10+
display: flex;
11+
justify-content: center;
12+
align-items: center;
13+
background-color: black;
14+
font-family: Arial, sans-serif;
15+
}
16+
17+
18+
.game-container {
19+
display: flex;
20+
flex-direction: column;
21+
align-items: center;
22+
width: 100%;
23+
height: 100%;
24+
max-width: 100vw;
25+
max-height: 100vh;
26+
overflow: hidden;
27+
}
28+
29+
30+
.score-display {
831
color: white;
9-
}
32+
font-size: 2rem;
33+
margin-bottom: 10px;
34+
text-align: center;
35+
}
36+
37+
38+
canvas {
39+
display: block;
40+
background-color: #000;
41+
max-width: 100%;
42+
max-height: 100%;
43+
border: 1px solid white;
44+
}
45+
46+
/* Small screens adjustments */
47+
@media (max-width: 600px) {
48+
.score-display {
49+
font-size: 1.5rem;
50+
}
51+
}
52+
53+
@media (max-width: 400px) {
54+
.score-display {
55+
font-size: 1.2rem;
56+
}
57+
}

0 commit comments

Comments
 (0)