-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (45 loc) · 1.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<head>
<title>Simple Snake Game</title>
<style>
/* Set the canvas size and background color */
canvas {
background-color: rgb(7, 0, 0);
display: block;
margin: 0 auto;
border: 2px solid black;
}
/* Add a background image to the canvas to make it look more interesting */
canvas {
background-image: url("https://images.unsplash.com/photo-1478760329108-5c3ed9d495a0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=3174&q=80");
background-size: cover; /* Scale the image to fit the canvas */
background-repeat: no-repeat; /* Don't repeat the image */
}
/* Style the score display */
#score {
text-align: center;
font-size: 20px;
font-weight: bold;
margin-top: 10px;
}
/* Style the game over message */
#gameover {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 40px;
font-weight: bold;
text-align: center;
display: none;
}
</style>
</head>
<body>
<canvas id="gameCanvas" width="500" height="500"></canvas>
<div id="score"></div>
<div id="gameover">Game Over</div>
<script src="snake.js"></script>
</body>
</html>