Skip to content

Commit

Permalink
Game finished
Browse files Browse the repository at this point in the history
  • Loading branch information
swati22446 committed Oct 21, 2024
1 parent 095ea50 commit 6b35712
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 11 deletions.
13 changes: 8 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Space Invader Game</title>
<script src="game.js" defer ></script>
<script src="game.js" defer></script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<canvas></canvas>
<p><span>Score:</span><span>0</span></p>

<div class="game-container">
<p class="score-display">
<span>Score: </span><span id="score">0</span>
</p>
<canvas></canvas>
</div>
</body>
</html>
</html>
60 changes: 54 additions & 6 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,57 @@
body{

* {
margin: 0;
overflow:hidden;
padding: 0;
box-sizing: border-box;
}
p{
position: fixed;
z-index: 10;

html, body {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: black;
font-family: Arial, sans-serif;
}


.game-container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
height: 100%;
max-width: 100vw;
max-height: 100vh;
overflow: hidden;
}


.score-display {
color: white;
}
font-size: 2rem;
margin-bottom: 10px;
text-align: center;
}


canvas {
display: block;
background-color: #000;
max-width: 100%;
max-height: 100%;
border: 1px solid white;
}

/* Small screens adjustments */
@media (max-width: 600px) {
.score-display {
font-size: 1.5rem;
}
}

@media (max-width: 400px) {
.score-display {
font-size: 1.2rem;
}
}

0 comments on commit 6b35712

Please sign in to comment.