I'll build a 2D Minecraft-inspired voxel mining/building game with procedural terrain, block breaking/placing, enemies, day/night cycle, and all the polish requested. Let me start by examining the project structure.
Now let me build the game. I'll create a comprehensive 2D Minecraft game with canvas rendering and React UI overlays. Let me update the title and create all the game files.
Now let me create the game types and constants:
Now the world generation module:
Now the core game engine:
Minor lint issue, let me fix it:
There's another pcy somewhere. Let me check:
The pcy is used at line 600 but never referenced. Let me fix it:
Now let me create the main App component with all UI overlays:
Let me fix the unused import:
Now update the CSS to include some essentials:
Now let's try building:
It builds. Now let me test the game logic and add some improvements. Let me review the engine to make sure the menu screen renders the background properly:
The engine renders even on menu state (the game loop's render call). But when the world isn't loaded, we need to handle it. Let me check the render method:
The render will still draw the sky which is fine as a background for the menu. Let me make the render a bit more robust for the menu state - a nice animated background:
Let me update the render to handle menu/paused/gameover states showing just a pretty background:
Now let me also add ambient particles on the menu screen and add some polish. Let me also fix the HighScore unused import warning:
Oops, HighScore is used in the class. Let me add it back:
Let me build again:
The build is successful. Now let me review the game for completeness and add some improvements. Let me check the touch mining is working correctly, and also make the game feel more polished with a few more tweaks:
The game is functional. Let me now enhance it with a few more features to make it more polished - better visual feedback, ambient effects, and smoother animations. Let me add some improvements to make the first 10 seconds feel great:
Let me add a nice underground lighting effect - blocks further from the player are darker, making torches/surface light feel natural. Also add ambient particles like dust:
Let me add a depth-based darkening effect and vignette for more atmosphere. I'll add it after the main render:
Now let me also enhance the spawn logic so enemies feel more threatening at night, and add some environmental polish. Let me also verify the game loop handles touch place correctly:
Good. Let me now build and verify everything compiles:
Now let me review the entire game for any issues and add the final polish - I want to make sure:
- The game is fun within 10 seconds
- Touch controls work well
- Visual feedback is satisfying
Let me enhance the block breaking to feel more "juicy" - bigger particles, more impactful shake, and add a satisfying sound-like visual flash:
Let me enhance the breakBlock for more juice:
Now let me also make the mining process feel more responsive - add a slight wobble to the block being mined:
Let me improve the floating text rendering to scale up for big scores:
Let me also make the star particles twinkle more visually:
Let me also enhance the mining indicator rendering to look more dramatic:
Let me make the mining indicator wobble the block:
Let me build again to make sure everything compiles:
Now let me review the game overall one more time for issues. Let me check if there are potential problems with touch events or the game loop:
The game looks solid. Let me make a few final improvements:
- Add a crosshair cursor when playing
- Make the ground collision snapping more robust
- Add a slight bob to the player when walking
Now let me also make the player rendering more lively with a breathing idle animation and walking bob:
Let me now add a breathing idle animation to the player:
Let me use the breathe variable:
Let me build again:
The game builds successfully. Let me also add water blocks in lower areas for more visual interest, and improve the world generation slightly:
Good. The world generation looks solid. Let me now do a final review of the complete App component to make sure everything is polished:
The game looks complete. Let me do a final build to confirm everything works:
The build succeeds. Let me verify all the files are in order:
Everything is in place. Here's a summary of what was built:
MiniCraft – 2D Minecraft Browser Game
Architecture
src/game/types.ts — All type definitions, block types (16 blocks including grass, dirt, stone, ores, wood, etc.), block colors, hardness, scores, and game constants
src/game/world.ts — Procedural world generation with FBM noise: terrain heightmap, caves, ore veins (coal, iron, gold, diamond), trees, sand patches, bedrock
src/game/engine.ts — Full game engine (~1375 lines) with canvas rendering, physics, AI, particles, camera system
src/App.tsx — React UI overlays: HUD, menus, touch controls, inventory bar
Core Features
- Block Mining — Click/tap blocks to mine them with progressive crack animation, wobble effects, and particle bursts
- Block Placing — Right-click to place collected blocks (adjacent to existing blocks)
- Inventory System — 9-slot hotbar with scroll/number key selection, shows block previews and counts
- Three Enemy Types — Zombies (tanky), Skeletons (fast), Creepers (explosive damage), with AI pathfinding and jumping
- Day/Night Cycle — Dynamic sky gradients with sunrise/sunset, stars at night, more enemies spawn in darkness
Juice & Polish
- Screen Shake — On block break, landing, taking damage, and killing enemies (scaled by impact)
- Particle System — Block-colored debris on mining, damage particles, sparkle crosses for diamonds/gold
- Floating Score Text — Animated "+N" popups that scale up for rare blocks, color-coded by value
- Underground Lighting — Radial darkness gradient deepens as you dig, centered on player
- Vignette Effect — Subtle edge darkening for atmosphere
- Screen Flash — Red flash on damage, white flash on rare ore discovery
- Player Animation — Walking leg/arm swing, breathing idle, walk bob, attack arm swing, invincibility blink
- Mining Indicator — Block wobble, crack lines, pulsing progress bar with glow
Game States
- Start Screen — Animated sky background with rolling terrain, controls guide, high scores button
- Playing — Full HUD with score, depth meter, heart-based HP, inventory bar, pause button
- Paused — Overlay with resume/quit options (ESC or P key)
- Game Over — Death screen with final score, depth, "New High Score" celebration, instant restart
- High Score Table — Top 10 local scores with medals (🥇🥈🥉), persisted to localStorage
Controls
- Desktop — WASD/Arrows to move, Space to jump, Left-click mine/attack, Right-click place, Scroll/1-9 select slot
- Mobile — On-screen D-pad (left/right), jump button, place button, tap canvas to mine/attack
Files built: index.html, src/game/types.ts, src/game/world.ts, src/game/engine.ts, src/App.tsx, src/index.css