Looking at this, I'll build a polished 2D top-down voxel mining game — a "Minecraft-lite" where the player walks around a blocky grid world, breaking blocks for points while avoiding creepers and racing against a timer. Canvas-based for smooth 60fps, with particles, screen shake, and both keyboard + touch controls.
Let me start by exploring the project structure.
Now I'll build the game. I'll create a single engine file with all game logic, a React component that hosts the canvas and UI overlays, and update the entry point.
Now the React component that hosts the canvas, handles input (keyboard + touch joystick), and overlays the UI for each game state.
Now update App.tsx to render the game and update index.css for the pixel-font title styling.
Now let's build and see if it compiles.
The build succeeded cleanly. Here's a summary of what I built:
🎮 Voxel Miner — A Polished Minecraft-Inspired Mining Game
Core Loop (fun within 10 seconds)
- Spawn in a small clearing surrounded by mineable blocks
- Walk into any block to auto-mine it with particles, screen shake, and a score popup flying up
- Chain mines for combo multipliers (up to 5×) — rewards aggressive play
- Rare ores give bonus time (diamonds +3s, gold +1.5s, iron +1s), so risk/reward pulls you outward
Controls
- Keyboard: WASD / Arrows to move, Space to mine, P or Esc to pause, Enter to start/restart
- Touch: Floating virtual joystick on the left half of the screen; moving auto-mines (no fiddly tap-to-mine)
Juicy Feedback
- Screen shake scales with block rarity (3px for dirt → 14px for diamond, 20px for creeper explosions)
- Particle bursts in block-matching colors when mining or exploding
- Score popups float up showing points + combo multiplier
- Crack overlays appear on blocks as they take damage before breaking
- Creeper fuse flashes white right before detonating
Game States
- Start screen with title, block-scoring guide, how-to-play, and best score
- Playing with live HUD (score, combo, depth, timer, hearts, pause button)
- Paused with resume/restart options
- Game Over with final score, "NEW BEST!" indicator, and top-5 local high-score leaderboard (localStorage)
Visual Theme
- Pixel-rendered blocks with deterministic noise patterns (grass, dirt, stone, coal, iron, gold, diamond, bedrock)
- Custom pixel Steve-style player sprite with walk animation, facing direction, and damage blink
- Custom creeper sprite with flashing fuse
- Chunky pixel-font title with multi-layer text-shadow for a blocky look
- Dark cave-floor pattern with subtle sparkle dots
Performance
- Canvas 2D with DPR scaling and
imageSmoothingEnabled = false
- Only blocks in the viewport are rendered
- Block patterns cached to offscreen canvases
- Delta-time clamped to 50ms to prevent physics explosions
- Smooth camera follow with lerp
Tech
src/game/engine.ts — all game logic, world gen, update/render loops, high-score persistence
src/components/Game.tsx — React canvas host + state-driven UI overlays + input handling
src/App.tsx — mounts the Game
src/index.css — Tailwind + pixel-title styling
Build output: 236.98 kB (gzipped 73.27 kB) — single-file deployment, ready to serve.
Files built: src/game/engine.ts, src/components/Game.tsx, src/App.tsx, src/index.css, index.html