-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
300 lines (293 loc) · 7.73 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Language" content="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#000000">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta property="og:title" content="Rockfall" />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://greggman.github.io/rockfall/docs/imgs/screenshot.png" />
<meta property="og:description" content="Rockfall, a game where rocks fall" />
<meta property="og:url" content="https://greggman.github.io/rockfall/" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@greggman">
<meta name="twitter:creator" content="@greggman">
<meta name="twitter:domain" content="greggman.github.io">
<meta name="twitter:title" content="Rockfall">
<meta name="twitter:url" content="https://greggman.github.io/rockfall/">
<meta name="twitter:description" content="Rockfall, a game where rocks fall">
<meta name="twitter:image:src" content="https://greggman.github.io/rockfall/docs/imgs/screenshot.png">
<link href="resources/images/rockfall-icon.png" rel="shortcut icon" type="image/png">
<link href="resources/images/rockfall-icon.png" rel="apple-touch-icon" type="image/png">
<title>RockFall</title>
<style>
html, body {
height: 100%;
margin: 0;
background: black;
color: white;
box-sizing: border-box;
font-family: monospace;
}
* {
box-sizing: inherit;
}
a {
color: red;
}
#content {
display: flex;
height: 100%;
}
#playField {
width: 100%;
height: 100%;
display: block;
background-color: black;
}
#top {
position: absolute;
left: 0;
top: 0;
padding: 5px;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
#hud {
cursor: pointer;
display: flex;
align-items: center;
min-width: 0;
flex: 1 1 auto;
}
#hud,
select {
font-family: monospace;
font-weight: bold;
color: white;
font-size: large;
text-shadow: 0.25em 0.25em black;
}
#hud>* {
margin-right: 0.5em;
white-space: nowrap;
}
#name {
flex: 1 1 auto;
overflow: hidden;
min-width: 0;
}
#github a {
display: flex;
font-weight: bold;
}
#github a,
#github img {
cursor: pointer;
text-decoration: none;
vertical-align: text-bottom;
}
#github img {
width: 1em;
}
#splash,
#loading,
#start,
#end {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0.8);
color: white;
font-family: sans-serif;
font-weight: bold;
font-size: 36pt;
}
#splash {
font-size: 24pt;
}
#start {
font-size: 24pt;
background: transparent;
user-select: none;
pointer-events: none;
}
#end {
align-items: stretch;
text-align: center;
background: none;
}
#start * {
margin-block: 0.50em;
}
#start>div {
background-color: rgba(50, 50, 248, 0.5);
border: 0.2em solid white;
border-radius: 1em;
max-width: 800px;
padding: 0.5em;
}
#splash * {
margin-block: 0.50em;
}
#splash>div {
background-color: rgba(50, 50, 248, 0.824);
border-radius: 1em;
max-width: 800px;
padding: 1em;
}
#splash button,
#end button {
border: none;
padding: 1em;
border-radius: 1em;
font-size: 24pt;
font-weight: bold;
color: white;
width: 100%;
}
#splash button {
background: rgba(255, 255, 255, 0.3);
}
#splash button:hover {
background: rgba(255, 255, 255, 0.6);
}
#end button {
background: rgba(0, 0, 0, 0.6);
margin-top: 1em;
width: 80%;
max-width: 400px;
}
#end button:hover {
background: rgba(100, 0, 150, 0.6);
}
select,
select:focus {
background-color: transparent;
color: white;
border: none;
padding: 0 1em 0 0;
margin: 0;
outline: none;
}
.debug {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: block;
pointer-events: none;
}
.exit-open {
animation: exit-open 0.2s alternate infinite;
}
@keyframes exit-open {
0% {
color: green;
}
100% {
color: greenyellow;
}
}
@media (max-width: 500px) {
#splash {
font-size: 16pt;
}
#splash button,
#end button {
border: none;
padding: 1em;
border-radius: 1em;
font-size: 16pt;
font-weight: bold;
color: white;
width: 100%;
}
}
.slide-in-out {
animation: anim-slide-in-out 2s forwards;
}
.slide-off {
animation: anim-slide-off 0.1s forwards;
}
@keyframes anim-slide-off {
from {
transform: translate(-100%);
}
to {
transform: translate(-101%);
}
}
@keyframes anim-slide-in-out {
from {
transform: translate(-100%);
}
10% {
transform: translate(0);
}
90% {
transform: translate(0);
}
to {
transform: translate(100%);
}
}
</style>
</head>
<body>
<div id="content">
<canvas id="playField"></canvas>
<div id="top">
<div id="hud">
<div id="restart">🔄</div>
<div id="time"></div>
<div id="score"></div>
<div><span>goal:</span><span id="goal"></span></div>
<div id="die">☠️</div>
<div id="name"></div>
</div>
<div id="github"><a target="_blank" href="https://github.com/greggman/rockfall#rules"><span>?</span><img src="resources/images/octocat-icon.svg"></a></div>
</div>
</div>
<div id="start">
<div>
<h1 id="level-name"></h1>
<p id="level-description"></p>
</div>
</div>
<!--
<div id="end">
<div><button type="button">Restart</button></div>
<div><button type="button">Randomize</button></div>
</div>
-->
<div id="splash">
<div>
<h1>RockFall</h1>
<p>A game where rocks fall!</p>
<p>
Collect diamonds and eggs
to open the exit 🧧. [<a href="https://github.com/greggman/rockfall#rules">details here</a>]</p>
<button type="button">Start</button>
<p><a target="_blank" href="https://greggman.github.io/rockfall/docs/making-levels.html">Make your own levels and add them to this game!</a></p>
</div>
</div>
<div id="loading"><div>loading...</div></div>
</body>
<script src="src/rockfall.js" type="module"></script>
</html>