Minecraft 10

By Just Sparrow

Just Sparrow

0 subscribers

Based on the following code

Minecraft 9

Minecraft 9

Just Sparrow

7 views · 2h ago

9 views·2h ago·Recreated 1 times

About

This project is a recreate of Minecraft 9 — built by clicking "Recreate" and giving Claude (by Anthropic) an additional prompt. Two key improvements this time: mouse button controls have been swapped to match standard Minecraft (left-click breaks, right-click places), and procedural sound effects have been added using the Web Audio API. Every block now makes a satisfying sound when placed or broken, with different tones per block type — no external audio files needed.

Prompt Used

Make the following two changes to this Minecraft HTML file: Change 1: Swap left/right mouse button actions Currently in the mousedown event handler, e.button === 0 (left click) places a block and e.button === 2 (right click) removes a block. This is backwards from standard Minecraft controls. Swap them so that:

Left click (e.button === 0) → Remove block (break) Right click (e.button === 2) → Place block

Also update the #controls-help text to reflect the corrected controls. Change 2: Add procedural sound effects using Web Audio API Add block placement and removal sound effects generated entirely with the Web Audio API (no external audio files). Requirements:

Create a reusable AudioContext (lazy-initialized on first user interaction to comply with browser autoplay policies). Block break sound: Short noise burst filtered through a bandpass filter with quick decay (~0.08-0.12s), simulating a "crunch" or "snap." Vary the filter frequency slightly per block type:

Grass/Dirt: lower frequency (~300-500 Hz), softer feel Stone: mid frequency (~600-900 Hz), sharper/harder feel Wood: mid-low frequency (~400-700 Hz), slightly hollow feel

Block place sound: A short, low-pitched thud using an oscillator (triangle or sine wave, ~80-150 Hz) with rapid exponential decay (~0.1s), combined with a very brief noise click for impact texture. This should sound subtly different from the break sound — more of a solid "thump." Play the appropriate sound immediately when a block is placed or removed, passing the block type index so the sound can vary by material. Keep the implementation self-contained (no external libraries, no Tone.js). Total added code should be roughly 40-70 lines.

How to Use

Getting Started

  • Click the canvas to lock your cursor and start playing
  • Press Escape to release the cursor

Movement

  • W — Move forward
  • A — Move left
  • S — Move backward
  • D — Move right
  • Space — Jump

Camera

  • Move your mouse to look around (while pointer lock is active)

Block Selection

  • Click an inventory slot at the bottom of the screen, or press 1 (Grass), 2 (Dirt), 3 (Stone), 4 (Wood)

Building & Breaking

  • Left-click to break a block
  • Right-click to place the selected block type
  • Each block type has its own unique break and place sound
  • A crosshair in the center of the screen shows where you're aiming

Note: Controls now match standard Minecraft — left-click breaks, right-click places.

Want to take it further? Click "Recreate" to build on this version — try adding background music, a day/night cycle, or a health system!

More

If you enjoyed this, please hit the like button and subscribe! Your support helps us create more cool stuff on Coddie.

Loading comments...

Other Codes

No other codes yet