/terra-2d-pixel-adventure
prompt.txt
01Create a Terraria clone in a single HTML file using Canvas and pure JavaScript (no external libraries). The game should include:
02
03
04World & Generation:
05
062D procedural world generated with Perlin noise (400x200 tiles)
07Biomes: Forest, Desert, and Snow Tundra, determined by noise
08Terrain with undulating surface, procedurally generated caves
09Bedrock layer at the bottom
10Auto-generated trees (leaves + trunk) based on biome
11Ores: Iron, Gold, and Diamond distributed by depth
12
13Player:
14
15Movement with WASD/arrows, jump with Space/W
16Health system (100 HP) with passive regeneration
17Fall damage if distance exceeds a threshold
18Death with automatic respawn (drop inventory on death)
19Sprite drawn with Canvas (pixel art, no external images)
20
21Block & Tile System (16x16 pixels):
22
23Procedural textures generated in Canvas for: Dirt, Stone, Grass, Sand, Wood, Leaves, Iron Ore, Gold Ore, Diamond Ore, Snow, Torch, Plank, Workbench, Bedrock
24Solid/non-solid tiles with hardness for mining
25Mining mechanic (left click) with visual progress bar
26Block placement mechanic (right click)
27
28Inventory & Crafting:
29
3040-slot inventory with 10-slot hotbar (selectable with 1-0 keys and mouse wheel)
31Inventory UI with drag-and-drop, sort button
32Armor slots (head, chest, legs)
33Scrollable recipe list, crafting with R key or click
34
35Items & Recipes:
36
37Tools: Wood/Iron/Gold/Diamond Pickaxe (with power and speed stats)
38Swords: Wood/Iron/Gold/Diamond (with damage stats)
39Armor: Iron/Gold/Diamond (Helm, Plate, Legs with defense)
40Metal bars (Iron Bar, Gold Bar, Diamond) as intermediate materials
41Healing potions (normal and greater)
42Slime Crown to summon the boss
43Gel as a slime drop
44Crafting recipes for everything (e.g., 12 wood + 6 plank = Wood Pickaxe)
45
46Enemies:
47
48Slimes (jump around, spawn day and night, drop Gel)
49Zombies (spawn at night, deal more damage)
50Bats (spawn at night, fly toward the player)
51King Slime (boss summoned with Slime Crown, 500 HP, drops gold and spawns small slimes on death)
52Max 12 entities simultaneously, random off-screen spawning
53Knockback when hitting the player
54
55Day/Night & Environment:
56
57Day/night cycle with sky color transition
58Animated sun and moon
59Twinkling stars at night
60Moving clouds
61Snow particles in Snow biome, sand particles in Desert biome
623-layer parallax mountain backgrounds
63
64Lighting:
65
66Sunlight that gets blocked underground
67Torches with radial illumination (10-tile radius with falloff)
68Darkness overlay with variable transparency
69
70Audio (all procedural with Web Audio API, no audio files):
71
72Procedural BGM that changes based on biome and time (forest_day, forest_night, desert_day, desert_night, snow_day, snow_night, underground, cavern)
73Each pattern with different root note, tempo, scale, melody, and bass
74Sound effects: mining, placing, hitting, pickup, hurt, death, crafting, jumping, splat, item use
75M key to toggle music
76
77UI:
78
79Health bar with visual percentage and text
80Defense indicator
81Hotbar at the bottom with numbers and selection highlight
82Inventory panel with grid, armor section, and crafting recipe list
83Top-right info panel: Day/Night, current Seed, current Biome, Depth zone
84Floating centered notifications
85Death screen with respawn countdown
86Tile highlight cursor
87Controls displayed at the bottom
88
89Technical:
90
91Game loop with fixed timestep (60 FPS)
92Tile-based collision for player and entities
93Camera with smooth player tracking
94Everything in a single self-contained HTML file
95Pixel art with image-rendering: pixelated
96Crosshair cursor