-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
70 lines (68 loc) · 1.44 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
SPDX-FileCopyrightText: 2019 Petr Pucil <[email protected]>
SPDX-License-Identifier: CC0-1.0
-->
<html>
<head>
<title>Simple tank game</title>
<meta charset="utf-8">
<style>
body {
font-family: "Trebuchet MS";
margin: 1em;
padding: 2em;
}
kbd {
border: 1px solid #000;
border-radius: 2px;
padding: 1px 5px;
}
.game {
overflow: hidden;
float: left;
}
canvas, .score {
float: left;
}
.score, .alert-box-content {
padding: 0 .8em;
line-height: 2.5em;
background-color: #ddd;
}
.controls {
border: 1px solid #000;
display: inline-block;
padding: 1em;
float: right;
}
.alert-box {
position: fixed;
top: 0;
left: 0;
width: 100%;
overflow: hidden;
opacity: 0;
transition: opacity .5s;
}
.alert-box-visible .alert-box {
opacity: 1;
}
</style>
</head>
<body>
<h1>Simple tank game</h1>
<div class="game">
<canvas id="gameCanvas" style="border: 1px solid black;" width="600" height="400"></canvas>
<span class="score">Targets left: <span id="targetsLeft"></span></span>
</div>
<div class="controls">
<h2>Controls</h2>
<p><kbd>↑</kbd> <kbd>↓</kbd> – move forward/backward</p>
<p><kbd>←</kbd> <kbd>→</kbd> – rotate left/right</p>
<p><kbd>Space</kbd> – fire</p>
</div>
<div class="alert-box"><div class="alert-box-content" id="alertBoxContent"></div></div>
<script src="collision.js"></script>
<script src="game.js"></script>
</body>
</html>