index.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
  6. <meta name="theme-color" content="#1b1d22">
  7. <title>Blocky</title>
  8. <link rel="icon" href="img/module_icon.svg">
  9. <script src="../script/jquery.min.js"></script>
  10. <script src="../script/ao_module.js"></script>
  11. <link rel="stylesheet" href="css/style.css">
  12. <script type="importmap">
  13. {
  14. "imports": {
  15. "three": "./lib/three/three.module.min.js"
  16. }
  17. }
  18. </script>
  19. </head>
  20. <body>
  21. <canvas id="view"></canvas>
  22. <!-- ================= In-game HUD ================= -->
  23. <div id="hud" class="hidden">
  24. <div id="underwater"></div>
  25. <div id="hurt"></div>
  26. <div id="burning"></div>
  27. <div id="crosshair"></div>
  28. <pre id="debug" class="hidden"></pre>
  29. <div id="message"></div>
  30. <div id="saving" class="hidden">Saving...</div>
  31. <div id="bottom">
  32. <div id="itemName"></div>
  33. <div id="statusbars">
  34. <div class="barrow">
  35. <div id="hearts" class="iconrow"></div>
  36. <div class="barright">
  37. <div id="airbar" class="iconrow hidden"></div>
  38. <div id="foodbar" class="iconrow"></div>
  39. </div>
  40. </div>
  41. </div>
  42. <div id="hotbar"></div>
  43. </div>
  44. </div>
  45. <!-- ================= Chat / commands ================= -->
  46. <div id="chat">
  47. <div id="chatLog"></div>
  48. <input id="chatInput" class="hidden" type="text" maxlength="200" autocomplete="off" spellcheck="false" placeholder="Type a message or a /command (Tab completes)">
  49. </div>
  50. <!-- ================= Inventory / container screens ================= -->
  51. <div id="screen" class="hidden">
  52. <div id="screenPanel" class="panel"></div>
  53. <div class="screenhint">E or Esc to close</div>
  54. </div>
  55. <div id="cursorStack" class="hidden"></div>
  56. <div id="tooltip" class="hidden"></div>
  57. <!-- ================= Start screen ================= -->
  58. <div id="menu">
  59. <canvas id="logo" width="760" height="190"></canvas>
  60. <div class="tagline" id="tagline">Build anything. Survive the night.</div>
  61. <div class="page" id="pageMain">
  62. <button class="btn wide" id="btnPlay">Play</button>
  63. <button class="btn wide" id="btnSettings">Settings</button>
  64. <button class="btn wide" id="btnHelp">How to Play</button>
  65. <button class="btn wide" id="btnQuit">Quit</button>
  66. </div>
  67. <div class="page hidden" id="pageWorlds">
  68. <div class="box">
  69. <h2>Select World</h2>
  70. <div id="worldList" class="worldlist"></div>
  71. <div class="row">
  72. <button class="btn" id="btnPlayWorld" disabled>Play Selected World</button>
  73. <button class="btn" id="btnNewWorld">Create New World</button>
  74. </div>
  75. <div class="row">
  76. <button class="btn" id="btnDeleteWorld" disabled>Delete</button>
  77. <button class="btn" id="btnWorldsBack">Back</button>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="page hidden" id="pageCreate">
  82. <div class="box">
  83. <h2>Create New World</h2>
  84. <label class="field">World name
  85. <input type="text" id="newName" maxlength="40" value="New World">
  86. </label>
  87. <label class="field">Seed <small>(leave empty for a random one)</small>
  88. <input type="text" id="newSeed" maxlength="40" placeholder="Random">
  89. </label>
  90. <div class="field">Game mode
  91. <div class="toggle" id="newMode">
  92. <button class="btn on" data-mode="survival">Survival</button>
  93. <button class="btn" data-mode="creative">Creative</button>
  94. </div>
  95. <small id="modeHint">Gather resources, craft tools and keep yourself fed.</small>
  96. </div>
  97. <div class="field">Difficulty
  98. <div class="toggle" id="newDiff">
  99. <button class="btn" data-diff="0">Peaceful</button>
  100. <button class="btn" data-diff="1">Easy</button>
  101. <button class="btn on" data-diff="2">Normal</button>
  102. <button class="btn" data-diff="3">Hard</button>
  103. </div>
  104. <small id="diffHint"></small>
  105. </div>
  106. <label class="check"><input type="checkbox" id="newCheats" checked> Allow cheats (commands such as /give and /tp, game mode, time and weather)</label>
  107. <div class="row">
  108. <button class="btn" id="btnCreate">Create World</button>
  109. <button class="btn" id="btnCreateCancel">Cancel</button>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="footer"><span id="storageNote">Checking storage...</span></div>
  114. </div>
  115. <!-- ================= Overlays ================= -->
  116. <div id="loading" class="overlay hidden">
  117. <div class="box center">
  118. <h2 id="loadTitle">Generating terrain</h2>
  119. <div class="progress"><i id="loadBar"></i></div>
  120. <p id="loadText">Preparing the world...</p>
  121. </div>
  122. </div>
  123. <div id="sleep" class="hidden">
  124. <div class="sleepmsg">Sleeping...</div>
  125. <div class="sleephint">Press Shift to get up</div>
  126. <button class="btn" id="btnLeaveBed">Leave Bed</button>
  127. </div>
  128. <div id="pause" class="overlay dim hidden">
  129. <div class="menugrid">
  130. <h2 class="span2">Game Paused</h2>
  131. <button class="btn span2" id="btnResume">Back to Game</button>
  132. <button class="btn" id="btnDiff" title="How fast hunger drains">Difficulty: Normal</button>
  133. <button class="btn" id="btnCheats" title="Lets you use commands and the buttons below">Cheats: On</button>
  134. <button class="btn cheat" id="btnMode">Game Mode: Survival</button>
  135. <button class="btn cheat" id="btnTime">Time: Day</button>
  136. <button class="btn cheat" id="btnWeather">Weather: Clear</button>
  137. <button class="btn" id="btnCommands">Commands...</button>
  138. <button class="btn" id="btnPauseSettings">Settings...</button>
  139. <button class="btn" id="btnPauseHelp">How to Play...</button>
  140. <div class="gap span2"></div>
  141. <button class="btn span2" id="btnSaveQuit">Save and Quit to Title</button>
  142. </div>
  143. </div>
  144. <div id="cmdhelp" class="overlay hidden">
  145. <div class="box">
  146. <h2>Commands</h2>
  147. <p>Press <b>T</b> to open the chat line, or <b>/</b> to start a command right away. <b>Tab</b> completes
  148. command and item names, <b>Up</b> recalls earlier commands. Use <b>~</b> for your own position,
  149. e.g. <code>/tp ~ ~20 ~</code>. Commands other than /help and /seed need cheats turned on.</p>
  150. <div id="cmdlist" class="cmdlist"></div>
  151. <div class="row"><button class="btn" id="btnCmdDone">Done</button></div>
  152. </div>
  153. </div>
  154. <div id="death" class="overlay death hidden">
  155. <div class="box center">
  156. <h1>You Died</h1>
  157. <p id="deathText"></p>
  158. <button class="btn wide" id="btnRespawn">Respawn</button>
  159. <button class="btn wide" id="btnDeathTitle">Save and Quit to Title</button>
  160. </div>
  161. </div>
  162. <!-- Settings: the same two column button grid as the pause menu. Sliders
  163. are button shaped ranges with their value written on them. -->
  164. <div id="settings" class="overlay dim hidden">
  165. <div class="menugrid">
  166. <h2 class="span2">Settings</h2>
  167. <label class="slidebtn"><input type="range" id="setRender" min="2" max="12" step="1"><span id="valRender"></span></label>
  168. <label class="slidebtn"><input type="range" id="setFov" min="50" max="110" step="1"><span id="valFov"></span></label>
  169. <label class="slidebtn"><input type="range" id="setSens" min="0.2" max="3" step="0.05"><span id="valSens"></span></label>
  170. <label class="slidebtn"><input type="range" id="setBright" min="0" max="1" step="0.05"><span id="valBright"></span></label>
  171. <label class="slidebtn"><input type="range" id="setVolume" min="0" max="1" step="0.05"><span id="valVolume"></span></label>
  172. <label class="slidebtn"><input type="range" id="setAnimals" min="0" max="1" step="0.05"><span id="valAnimals"></span></label>
  173. <label class="slidebtn"><input type="range" id="setScale" min="0.5" max="1" step="0.25"><span id="valScale"></span></label>
  174. <button class="btn" id="setLeaves"></button>
  175. <button class="btn" id="setClouds"></button>
  176. <button class="btn" id="setBob"></button>
  177. <button class="btn" id="setInvert"></button>
  178. <button class="btn" id="setFps"></button>
  179. <button class="btn span2" id="setReal" title="Shadows, reflections, bloom and light shafts. Needs a fast graphics card."></button>
  180. <button class="btn span2" id="setWE" title="//set, //copy, //paste, //undo and the selection wand in creative mode. Type //help in chat."></button>
  181. <button class="btn span2" id="setShotDir" title="Where F2 saves screenshots"></button>
  182. <div class="gap span2"></div>
  183. <button class="btn span2" id="btnSettingsDone">Done</button>
  184. </div>
  185. </div>
  186. <div id="help" class="overlay hidden">
  187. <div class="box">
  188. <h2>How to Play</h2>
  189. <div class="helpgrid">
  190. <div><b>W A S D</b> move, <b>Space</b> jump, <b>Shift</b> sneak, <b>Ctrl</b> or double tap <b>W</b> to sprint</div>
  191. <div><b>Left mouse</b> mine a block, <b>Right mouse</b> place a block, use a workbench / furnace / chest, or eat</div>
  192. <div><b>1 - 9</b> or the <b>mouse wheel</b> pick a hotbar slot, <b>Middle click</b> a block to take it in hand</div>
  193. <div><b>E</b> inventory and 2 x 2 crafting, <b>Q</b> drop an item (Ctrl+Q the whole stack)</div>
  194. <div><b>T</b> chat, <b>/</b> type a command such as <b>/give</b> or <b>/tp</b></div>
  195. <div><b>Right click</b> a bed at night to sleep until morning, doors, gates and trapdoors to open them</div>
  196. <div><b>Left click</b> an animal to hit it; hold <b>Right click</b> with a bow to draw, let go to shoot</div>
  197. <div><b>Right click</b> levers and buttons, or step on a pressure plate, to power spark wire, lamps, pistons and doors</div>
  198. <div><b>Right click</b> a retimer to change its delay; it passes the signal on in the direction you placed it</div>
  199. <div>An <b>OpAmp</b> sends on the signal behind it, or how full the storage behind it is; a stronger signal at a side stops it. <b>Right click</b> to subtract the sides instead</div>
  200. <div><b>Right click</b> a sign to write on it (4 lines); Shift + right click to place a block against it</div>
  201. <div>Power a rail where three tracks meet (lever, button or spark wire) to switch it to the other track</div>
  202. <div><b>Right click</b> a cart to ride it (Shift to get out), a chest cart to open it, a furnace cart with fuel to drive it</div>
  203. <div><b>Creative:</b> double tap <b>Space</b> to fly, Space / Shift to rise and sink</div>
  204. <div><b>WorldEdit</b> (creative, turn it on in Settings): <b>//wand</b>, left / right click two corners, then <b>//set</b>, <b>//copy</b>, <b>//paste</b>, <b>//undo</b> - <b>//help</b> lists the rest. With a <b>compass</b> in hand, left click jumps to the block you look at, right click passes through the wall in reach</div>
  205. <div><b>F2</b> screenshot, <b>F3</b> debug info, <b>F1</b> hide the interface, <b>Esc</b> pause</div>
  206. </div>
  207. <p>Start by punching a tree for logs, turn them into planks on the 2 x 2 grid in your inventory (E), and
  208. build a workbench from four planks: it gives you a 3 x 3 grid. The recipe book next to the grid shows
  209. every pattern and lays it out for you. A wooden pickaxe
  210. mines stone; stone tools mine iron, iron tools mine gold and crystal. Smelt ores in a furnace.
  211. Keep your food bar up: apples drop from leaves, seeds from tall grass grow into wheat for bread,
  212. and two mushrooms with a bowl make stew. Harder difficulties make you hungry faster.
  213. Cows, sheep and chickens give food, wool and feathers. Wolves and bears come out in the dark and,
  214. on Normal and Hard, hunt you at night - fight back with a sword or a bow and arrows.
  215. Dye white wool with flowers, leaves or coal. Spark dust from deep spark ore makes wire, spark
  216. torches, rails and pistons. On a fast computer, try Realistic Graphics in the settings.</p>
  217. <div class="row"><button class="btn" id="btnHelpDone">Got it</button></div>
  218. </div>
  219. </div>
  220. <div id="confirm" class="overlay hidden">
  221. <div class="box center">
  222. <h2 id="confirmTitle">Are you sure?</h2>
  223. <p id="confirmText"></p>
  224. <div class="row">
  225. <button class="btn danger" id="btnConfirmYes">Delete</button>
  226. <button class="btn" id="btnConfirmNo">Cancel</button>
  227. </div>
  228. </div>
  229. </div>
  230. <!-- ================= Touch controls ================= -->
  231. <div id="touch" class="hidden">
  232. <div id="stick"><div id="stickKnob"></div></div>
  233. <div id="lookpad"></div>
  234. <div class="tbtns">
  235. <button id="tJump">Jump</button>
  236. <button id="tSneak">Sneak</button>
  237. <button id="tInv">Items</button>
  238. <button id="tPause">Pause</button>
  239. </div>
  240. </div>
  241. <div id="error" class="overlay hidden">
  242. <div class="box center">
  243. <h2>Blocky could not start</h2>
  244. <p id="errorText"></p>
  245. </div>
  246. </div>
  247. <script type="module" src="js/main.js"></script>
  248. </body>
  249. </html>