Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
430 lines (409 loc) · 22.9 KB
/
Copy pathindex.html
File metadata and controls
430 lines (409 loc) · 22.9 KB
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="MiniCrafter">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>MiniCrafter</title>
<meta name="description" content="A free block-building game for kids: explore, build, raise animals and learn to code with Bit the robot. Works offline.">
<link rel="stylesheet" href="style.css">
<link rel="manifest" href="manifest.webmanifest">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32.png">
<link rel="icon" type="image/png" sizes="192x192" href="icons/icon-192.png">
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png">
<meta name="theme-color" content="#3f7d2a">
<script type="importmap">
{
"imports": {
"three": "./vendor/three.module.js"
}
}
</script>
</head>
<body>
<div id="game" role="img" aria-label="MiniCrafter game view (the 3D world)"></div>
<div id="water-overlay" class="hidden"></div>
<div id="damage-flash"></div>
<div id="touch" class="hidden">
<div id="touch-look"></div>
<div id="stick"><div id="stick-knob"></div></div>
<button class="tbtn" id="t-pause" data-btn="pause" aria-label="Pause">⏸</button>
<button class="tbtn" id="t-undo" data-btn="undo" aria-label="Undo">↶</button>
<button class="tbtn" id="t-inv" data-btn="inventory" aria-label="Inventory">🎒</button>
<button class="tbtn" id="t-fly" data-btn="fly" aria-label="Fly">🕊️</button>
<button class="tbtn" id="t-emoji" data-btn="emoji" aria-label="Emoji">😊</button>
<button class="tbtn" id="t-photo" data-btn="photo" aria-label="Take a photo">📷</button>
<button class="tbtn hidden" id="t-respawn" data-btn="respawn" aria-label="Back to checkpoint">↺</button>
<button class="tbtn big" id="t-jump" data-btn="jump" aria-label="Jump / up">⬆</button>
<button class="tbtn" id="t-down" data-btn="down" aria-label="Down">⬇</button>
</div>
<div id="hud" class="hidden">
<div id="crosshair"></div>
<div id="tg-chip" class="hidden"></div>
<div id="course-hud" class="hidden"><span>⏱ <b id="course-time">0.00 s</b></span><span id="course-coins"></span><span class="course-key">R: back to checkpoint</span></div>
<div id="knock" class="hidden"><span id="knock-text"></span><button id="knock-yes" type="button">Let in <kbd>L</kbd></button><button id="knock-no" type="button">Not now <kbd>N</kbd></button></div>
<div id="emoji-bar" class="hidden"></div>
<div id="debug" class="hidden"></div>
<div id="toast" role="status"></div>
<div id="mode-badge" class="hidden">FLYING</div>
<div id="hint" role="status"></div>
<div id="quest-tracker">
<button id="qt-head" type="button"><span id="qt-stars">⭐ 0</span><span class="qt-key">Quests (Q)</span></button>
<div id="qt-list"></div>
</div>
<div id="celebrate" role="status"><div class="c-title">Quest complete!</div><div class="c-name"></div><div class="c-stars"></div><div class="c-reveal"></div></div>
<div id="status" class="hidden">
<div id="hearts"></div>
<div class="status-right"><div id="bubbles"></div><div id="hunger"></div></div>
</div>
<div id="charge" class="hidden"><div id="charge-fill"></div></div>
<div id="armor-ind"></div>
<div id="xpbar" class="hidden"><div id="xp-fill"></div><span id="xp-level">0</span></div>
<div id="hotbar"></div>
</div>
<div id="menu" class="overlay" role="main">
<div class="panel menu-panel">
<div class="menu-main">
<div class="brand">
<img src="icons/icon-192.png" alt="" class="logo" width="64" height="64">
<div>
<h1>MiniCrafter</h1>
<p class="tag">Explore · Build · Code</p>
</div>
</div>
<p id="loading">Generating world…</p>
<button id="btn-play" class="primary">▶ Play</button>
<button id="btn-together" class="wide-btn together-btn">👫 Play Together <span id="tg-menu-state"></span></button>
<a id="btn-online" class="wide-btn online-link hidden" href="#" target="_blank" rel="noopener">🌐 Play online with friends <small>(beta: Play Together, accounts)</small></a>
<button id="btn-account" class="wide-btn hidden">👤 <span id="acc-menu">Log in or create an account</span></button>
<div class="section world-row">
<div><span class="note">World</span><div id="world-name">—</div><div class="note" id="world-info"></div></div>
<button id="btn-worlds" type="button">🗂 My worlds</button>
</div>
<button id="btn-install" class="wide-btn hidden">📲 Install MiniCrafter as an app</button>
<div id="install-help" class="install-help hidden" role="note">
<b>📲 Put MiniCrafter on your Home Screen</b>
<ol id="install-steps"></ol>
<p class="note">Then open it from the icon: it fills the whole screen, works offline, and keeps your worlds safe.</p>
</div>
<button id="btn-quests" class="wide-btn">⭐ Quest book <span id="menu-stars"></span></button>
<p id="lock-note" class="note"></p>
<div class="idea-card">
<span class="idea-label">💡 Today's building idea</span>
<p id="idea-text"></p>
<button id="btn-idea" type="button">Another idea</button>
</div>
</div>
<div class="menu-side">
<div class="mode-pick">
<span>Game mode</span>
<div class="seg">
<button id="mode-creative" type="button">Creative</button>
<button id="mode-survival" type="button">Survival</button>
<button id="mode-adventure" type="button">⚔️ Adventure</button>
</div>
</div>
<p class="note" id="mode-desc"></p>
<details class="fold" id="settings-fold">
<summary>⚙️ Settings</summary>
<div class="section">
<label>Render distance <span id="rd-val"></span>
<input id="rd" type="range" min="3" max="12" step="1">
</label>
<label>Mouse sensitivity <span id="sens-val"></span>
<input id="sens" type="range" min="0.2" max="3" step="0.1">
</label>
<label>Field of view <span id="fov-val"></span>
<input id="fov" type="range" min="55" max="100" step="1">
</label>
<label>Night creatures (⚔️ Adventure only)
<select id="monsters"><option value="easy">Easy: fewer, gentler</option><option value="normal">Normal</option></select>
</label>
</div>
</details>
<details class="fold">
<summary>🎮 Controls</summary>
<table class="controls">
<tr><td>W A S D</td><td>Move</td></tr>
<tr><td>Mouse</td><td>Look around</td></tr>
<tr><td>Space</td><td>Jump / swim up / fly up</td></tr>
<tr><td>Shift</td><td>Sprint (fly down while flying)</td></tr>
<tr><td>F</td><td>Toggle flying (creative)</td></tr>
<tr><td>Left click (hold)</td><td>Break block</td></tr>
<tr><td>Right click (hold)</td><td>Place block</td></tr>
<tr><td>Middle click</td><td>Pick block into hotbar</td></tr>
<tr><td>1–9 / Mouse wheel</td><td>Select hotbar slot</td></tr>
<tr><td>E</td><td>Inventory & crafting</td></tr>
<tr><td>Right click (food)</td><td>Eat an apple (survival)</td></tr>
<tr><td>Right click (lever)</td><td>Flip a Spark Lever or press a Button</td></tr>
<tr><td>Hold right click</td><td>Draw the bow / raise the shield (⚔️ Adventure)</td></tr>
<tr><td>Q</td><td>Quest book</td></tr>
<tr><td>Z / Y</td><td>Undo / redo (creative)</td></tr>
<tr><td>F3</td><td>Debug info</td></tr>
<tr><td>T then 1–8</td><td>Send an emoji (Play Together)</td></tr>
<tr><td>P</td><td>📷 Photo Mode</td></tr>
<tr><td>R</td><td>Back to the last checkpoint (Course Maker)</td></tr>
<tr><td>L / N</td><td>Let a friend in / not now (host)</td></tr>
<tr><td>Esc</td><td>Pause</td></tr>
</table>
</details>
<p class="note touch-only">Touch: left stick walks, drag to look, tap to place or flip, hold to mine or attack. Holding a bow or shield? Hold to draw or block.</p>
<p class="note">Your world is saved automatically in this browser. <span id="offline-note"></span> <span id="game-version"></span></p>
<button id="btn-report" class="wide-btn report-btn hidden" type="button">🐞 Report a problem</button>
<p class="note legal-links"><a href="features.html" target="_blank" rel="noopener">✨ All features</a> · <a href="privacy.html" target="_blank" rel="noopener">Privacy Policy</a> · <a href="terms.html" target="_blank" rel="noopener">Terms of Use</a></p>
</div>
</div>
</div>
<div id="together" class="overlay hidden">
<div class="panel tg-panel">
<h2>👫 Play Together</h2>
<p class="note">Build with family and friends, up to 4 players. There's no chat, just emoji, and the host lets each player in.</p>
<div class="tg-me">
<div>You are <b id="tg-name"></b></div>
<div id="tg-colors" class="chips" role="group" aria-label="Pick a colour"></div>
<div id="tg-animals" class="chips" role="group" aria-label="Pick an animal"></div>
</div>
<div id="tg-login" class="tg-login hidden">
<p>🔒 <b>Log in to play together.</b> It keeps Play Together safe: only people with an account can make or join a game.</p>
<button id="tg-login-btn" class="primary" type="button">👤 Log in or create an account</button>
</div>
<div id="tg-start" class="tg-start">
<div class="tg-card">
<h3>🏠 Host this world</h3>
<p class="note">Friends join with a code. Works in Creative and Survival.</p>
<button id="tg-host" class="primary">Start a game</button>
</div>
<div class="tg-card">
<h3>🚪 Join a friend</h3>
<p class="note">Type the code from the host's screen.</p>
<div class="tg-row"><input id="tg-code" type="text" maxlength="4" autocomplete="off" autocapitalize="characters" spellcheck="false" placeholder="CODE" aria-label="Room code"><button id="tg-join" class="primary">Join</button></div>
</div>
</div>
<div id="tg-room" class="hidden">
<p class="tg-code-label">Room code: tell your friends</p>
<div id="tg-code-big"></div>
<div id="tg-knocks"></div>
<ul id="tg-players"></ul>
<div class="tg-row"><button id="tg-lock" type="button">🔓 Room open</button><button id="tg-play" class="primary" type="button">▶ Play</button><button id="tg-end" type="button">End game</button></div>
</div>
<p id="tg-status" class="note"></p>
<button id="tg-close" class="wide-btn" type="button">Back</button>
</div>
</div>
<div id="account" class="overlay hidden">
<div class="panel acc-panel">
<h2>👤 Your account</h2>
<div id="acc-out">
<div class="seg acc-tabs"><button id="acc-tab-login" type="button" class="on">Log in</button><button id="acc-tab-new" type="button">Create an account</button></div>
<form id="acc-form" autocomplete="on">
<label>Username<input id="acc-user" type="text" autocomplete="username" autocapitalize="none" spellcheck="false" maxlength="20" required></label>
<label>Password<input id="acc-pass" type="password" autocomplete="current-password" maxlength="200" required></label>
<div id="acc-new-extra" class="hidden">
<label>Password again<input id="acc-pass2" type="password" autocomplete="new-password" maxlength="200"></label>
<label><span>What year were you born? <span class="hint">(we don't keep it)</span></span><select id="acc-year"><option value="">Choose a year…</option></select></label>
<div id="acc-grownup" class="acc-grownup hidden">
<p><b>👨👩👧 Grown-up step.</b> Players under 13 need a parent or guardian to set up an account. Grown-up: please read the <a href="privacy.html" target="_blank" rel="noopener">Privacy Policy</a> and <a href="terms.html" target="_blank" rel="noopener">Terms of Use</a>.</p>
<label class="check"><input id="acc-parent" type="checkbox"> I'm this player's parent or guardian, and I agree for them.</label>
<label><span>Grown-up check: what is <b id="acc-q"></b>?</span><input id="acc-a" type="text" inputmode="numeric" maxlength="4" autocomplete="off"></label>
</div>
<label class="check"><input id="acc-agree" type="checkbox"> I agree to the <a href="terms.html" target="_blank" rel="noopener">Terms of Use</a> and the <a href="privacy.html" target="_blank" rel="noopener">Privacy Policy</a>.</label>
</div>
<button id="acc-submit" class="primary" type="submit">Log in</button>
</form>
<p class="note acc-privacy">🛡️ <b>Make up a username, don't use your real name.</b> Your username is private: other players only see your colour-and-animal name. We don't ask for an email address or anything else about you. Kids: ask a grown-up to help you. <a href="privacy.html" target="_blank" rel="noopener">Privacy</a> · <a href="terms.html" target="_blank" rel="noopener">Terms</a></p>
</div>
<div id="acc-in" class="hidden">
<p>You're logged in as <b id="acc-name"></b>.</p>
<button id="acc-logout" class="wide-btn" type="button">Log out</button>
<details class="fold">
<summary>Delete my account</summary>
<div class="section">
<p class="note">This deletes your account straight away. It can't be undone. Your worlds on this device stay.</p>
<label>Your password<input id="acc-del-pass" type="password" autocomplete="current-password" maxlength="200"></label>
<button id="acc-delete" type="button" class="danger">Delete my account</button>
</div>
</details>
</div>
<p id="acc-msg" class="note" role="status"></p>
<button id="acc-done" class="wide-btn" type="button">Back</button>
</div>
</div>
<div id="news" class="overlay hidden">
<div class="panel news-panel">
<h2>✨ What's new: <span id="news-title"></span></h2>
<ul id="news-list" class="news-list"></ul>
<p class="note"><a href="features.html">See all features</a></p>
<button id="news-done" class="wide-btn" type="button">Got it!</button>
</div>
</div>
<div id="report" class="overlay hidden">
<div class="panel report-panel">
<h2>🐞 Report a problem</h2>
<p class="note">What went wrong? Pick one. We'll also get your device type, browser, game version and your last few steps in the game (nothing about who you are) so we can fix it.</p>
<div id="report-choices" class="report-choices"></div>
<button id="report-done" class="wide-btn" type="button">Cancel</button>
</div>
</div>
<div id="photo" class="overlay hidden">
<div class="panel photo-panel">
<h2>📷 Photo Mode</h2>
<div id="ph-canvas" class="ph-canvas" title="Tap the photo to add a sticker"></div>
<div class="ph-controls">
<div><span class="ph-label">Frame</span><div id="ph-frames" class="chips"></div></div>
<div><span class="ph-label">Filter</span><div id="ph-filters" class="chips"></div></div>
<div><span class="ph-label">Stickers: pick one, then tap the photo</span><div id="ph-stickers" class="chips ph-stickers"></div></div>
<label id="ph-caption-row"><span class="ph-label">Caption</span><input id="ph-caption" type="text" maxlength="40" placeholder="My amazing castle!" autocomplete="off"></label>
</div>
<div class="tg-row">
<button id="ph-undo" type="button">↶ Undo sticker</button>
<button id="ph-share" type="button">📤 Share</button>
<button id="ph-save" class="primary" type="button">💾 Save photo</button>
</div>
<p class="note">Photos are saved on your device. Nothing is uploaded.</p>
<button id="ph-close" class="wide-btn" type="button">Back to the game</button>
</div>
</div>
<div id="inventory" class="overlay hidden">
<div class="panel wide">
<h2>Blocks</h2>
<p class="note">Click a block to put it in hotbar slot <b id="inv-slot">1</b>.</p>
<div id="inv-tabs" class="tabs" role="tablist"></div>
<div id="inv-grid"></div>
<button id="inv-done" class="primary done">Done</button>
</div>
</div>
<div id="craft" class="overlay hidden">
<div class="panel craft-panel">
<div class="craft-inv">
<h2>Inventory</h2>
<p class="note">Click an item to pick it up, then click a slot to put it down.</p>
<div id="backpack" class="slot-grid"></div>
<div id="craft-hotbar" class="slot-grid hotrow"></div>
</div>
<div class="craft-recipes">
<h2>Crafting</h2>
<p class="note" id="station-note"></p>
<div id="recipes"></div>
<button id="craft-done" class="primary done">Done</button>
</div>
</div>
<div id="cursor-stack" class="hidden"></div>
</div>
<div id="pet" class="overlay hidden">
<div class="panel pet-panel">
<h2 id="pet-title">Your pet</h2>
<p id="pet-hearts" class="pet-hearts"></p>
<div class="pet-armor"><span id="pet-armor-icon" class="slot"></span><span id="pet-armor-name"></span><button id="pet-armor-off" type="button" class="hidden">Take off</button></div>
<p class="note" id="pet-note"></p>
<div id="pet-bag-wrap">
<h3>Backpack</h3>
<div id="pet-bag" class="slot-grid"></div>
<button id="pet-bag-off" type="button">Take the backpack off</button>
</div>
<div id="pet-inv-wrap">
<h3>Your things</h3>
<div id="pet-backpack" class="slot-grid"></div>
<div id="pet-hotbar" class="slot-grid hotrow"></div>
</div>
<div class="pet-actions"><button id="pet-sit" type="button">Sit</button><button id="pet-done" class="primary done">Done</button></div>
</div>
</div>
<div id="worlds" class="overlay hidden">
<div class="panel wide">
<h2>🗂 My worlds</h2>
<p class="note">Each world keeps its own buildings, animals, pets, robot program and stars.</p>
<div id="world-list"></div>
<h3 class="w-h3">✨ Make a new world</h3>
<div class="new-world">
<input id="nw-name" type="text" maxlength="30" placeholder="World name" aria-label="World name">
<input id="nw-seed" type="text" maxlength="40" placeholder="Seed (optional: same seed = same world)" aria-label="Seed (optional)">
<div class="seg"><button id="nw-creative" type="button" class="on">Creative</button><button id="nw-survival" type="button">Survival</button><button id="nw-adventure" type="button">⚔️ Adventure</button></div>
<label id="nw-hardcore-row" class="hc hidden"><input id="nw-hardcore" type="checkbox"> ☠️ Hardcore: one life only</label>
<button id="nw-create" class="go" type="button">Create</button>
</div>
<div class="rb-row">
<button id="w-import" type="button">⬆ Import a world file</button>
<input id="w-import-file" type="file" accept=".json,application/json" hidden>
</div>
<button id="w-done" class="primary done">Done</button>
</div>
</div>
<div id="trade" class="overlay hidden">
<div class="panel wide">
<h2 id="tr-title">Trade</h2>
<p class="note" id="tr-note"></p>
<div id="tr-list"></div>
<button id="tr-done" class="primary done">Done</button>
</div>
</div>
<div id="questbook" class="overlay hidden">
<div class="panel wide">
<h2>⭐ Quest book</h2>
<p class="note" id="qb-summary"></p>
<div id="qb-list"></div>
<button id="qb-done" class="primary done">Done</button>
</div>
</div>
<div id="robot-panel" class="hidden">
<div class="rb-head">
<span class="rb-face">🤖</span>
<div><h2>Bit the robot</h2><p class="note">Give Bit a program and watch it work.</p></div>
</div>
<div id="rb-status" class="rb-status idle"></div>
<p class="note" id="rb-editor-note"></p>
<div id="rb-blockly"></div>
<div class="rb-row" id="rb-controls">
<button id="rb-run" class="go" type="button">▶ Run</button>
<button id="rb-stop" type="button">⏹ Stop</button>
</div>
<div class="rb-row">
<button id="rb-code-toggle" type="button">👀 See the code</button>
<button id="rb-clear" type="button">🗑 Clear</button>
</div>
<pre id="rb-code" class="hidden"></pre>
<h3>Starter programs <span class="note">(load into the editor and run)</span></h3>
<div id="rb-examples"></div>
<div class="rb-row">
<span>Speed</span>
<div class="seg"><button data-speed="1" type="button">1×</button><button data-speed="2" type="button">2×</button><button data-speed="4" type="button">4×</button></div>
</div>
<div class="rb-row">
<button id="rb-away" type="button">Put Bit away</button>
</div>
<p class="note">Bit places the block you are holding. Bit can't break bedrock and stays near you.</p>
<button id="rb-close" class="primary done">Done</button>
</div>
<div id="rotate" class="overlay hidden" role="dialog" aria-labelledby="rotate-title">
<div class="panel center rotate-panel">
<div class="rotate-phone" aria-hidden="true">📱</div>
<h2 id="rotate-title">Turn your phone sideways</h2>
<p class="note">MiniCrafter needs the wide view. The game starts again as soon as you turn it.</p>
<button id="rotate-back" type="button">Back to the menu</button>
</div>
</div>
<div id="gate" class="overlay hidden">
<div class="panel center">
<h2>⚔️ Adventure mode is for older players</h2>
<p class="note">It has night creatures that fight back, hunger, tougher falls and losing your things when you faint. Grown-ups, please answer:</p>
<p class="gate-q" id="gate-q"></p>
<input id="gate-a" type="number" inputmode="numeric" placeholder="Answer" aria-label="Your answer">
<p class="note" id="gate-err"></p>
<div class="rb-row"><button id="gate-cancel" type="button">Back</button><button id="gate-ok" class="go" type="button">Continue</button></div>
</div>
</div>
<div id="death" class="overlay hidden">
<div class="panel center">
<h1 class="sad" id="death-title">Oops!</h1>
<p id="death-msg">You fainted.</p>
<p class="note" id="death-note">Don't worry, you keep all your items.</p>
<button id="btn-respawn" class="primary">Try again</button>
<button id="btn-spectate" class="primary hidden">👻 Watch the world</button>
</div>
</div>
<noscript><p class="nojs">MiniCrafter needs JavaScript and WebGL.</p></noscript>
<script type="module" src="src/main.js"></script>
</body>
</html>