I will explore the files in the project to understand its structure before building the physics mini-game.
I will read the package.json file to check the available libraries and see if Matter.js or canvas-confetti or Lucide icons are installed.
I will now install matter-js, lucide-react, and canvas-confetti to provide robust 2D rigid body physics (for the vehicle, ramp, and realistic brick smashing) and rich UI icons/celebrations.
I will create src/types.ts to define all game structures, including vehicles, levels, physics stats, and game states.
I will create src/utils/audio.ts to implement a custom procedural Web Audio sound synthesizer for realistic engine rumbles, tire screeches, heavy brick impacts, TNT explosions, coin jingles, and victory fans.
I will create src/data/vehicles.ts to define the 5 vehicles with their specific body parameters, wheel offsets, mass, engine acceleration, max speeds, and visual themes.
I will create src/data/levels.ts to define the 6 structured levels with distinct ramp layouts, obstacles (lava pits, aerial target rings, TNT explosive bricks), and unlock rewards.
I will create src/data/achievements.ts to define accomplishments players can work toward, providing additional coins and long-term replay value.
I will create src/components/Navbar.tsx to display the top navigation bar with the game logo, coin balance, level select trigger, garage button, sandbox trigger, and sound/rules modals.
I will create src/components/HowToPlayModal.tsx to display clear instructions on how to accelerate, reverse, trigger nitro boost, smash brick walls, and earn coins.
I will create src/components/AchievementsModal.tsx to list all game milestones, displaying progress bars and allowing players to claim coin rewards upon completion.
I will create src/components/LevelSelectModal.tsx to display an attractive grid of the 6 game stages, indicating unlocking conditions and rewards.
I will update src/components/LevelSelectModal.tsx to fix the type check for level.id.
I will correct the arithmetic operation on level.id in src/components/LevelSelectModal.tsx.
I will create src/components/GarageModal.tsx to allow players to purchase vehicles, inspect their physical stats, and upgrade their parts using collected coins.
I will create src/components/SandboxModal.tsx to let players configure custom physics sandbox parameters.
I will update src/components/SandboxModal.tsx to remove the unused Sparkles import.
I will create src/components/GameCanvas.tsx to run the Matter.js physics simulation and execute a highly polished custom HTML5 canvas render loop with camera tracking, parallax backgrounds, vehicle flames, TNT explosions, and rigid body shattering.
I will inspect the lines around the rendering of body.isRamp in src/components/GameCanvas.tsx to apply the exact replacement.
I will update the CustomBody interface and clean up unused imports in src/components/GameCanvas.tsx.
I will inspect lines 660 to 700 of src/components/GameCanvas.tsx to fix the ramp rendering variables.
I will inspect lines 145 to 165 of src/components/GameCanvas.tsx to locate upgradedTorque and upgradedMass.
I will update CustomBody to remove label and clean up unused variables in initPhysics in src/components/GameCanvas.tsx.
I will remove upgradedTorque and upgradedMass from initPhysics in src/components/GameCanvas.tsx.
I will read lines 665 to 690 in src/components/GameCanvas.tsx.
I will read lines 658 to 668 to get exact context for edit_file.
I will edit src/components/GameCanvas.tsx to use body.rampWidth and body.rampHeight when drawing the ramp.
I will now write src/App.tsx to connect all modals, coordinate persistent localStorage states (coins, upgrades, unlocked levels and vehicles), and render the top navbar alongside the interactive Matter.js physical game canvas.
I will edit src/App.tsx to add export default, remove unused imports, and rename score to _score.
I will rename the unused score parameter to _score in handleLevelWin in src/App.tsx.
I will now test building the project to make sure all TypeScript types and Vite bundles compile cleanly.
I will read index.html to inspect its title.
I will update the <title> in index.html to match our Spanish physics mini-game.
I will inspect src/index.css to add custom keyframe animation helper classes.
I will update src/index.css to add smooth modal animations and mobile optimization rules.
I will now build the project to confirm that all changes compile successfully.
¡He creado el minijuego de física "💥 CRASH & JUMP: Leyendas de la Rampa" siguiendo fielmente los requisitos solicitados y sumando un nivel de pulido espectacular!
✨ Características Principales
- 🚀 Dinámica de Vehículos y Controles Restringidos:
- Tu vehículo acelera con física real de tracción en las ruedas y solamente puedes moverte hacia adelante (D / Flecha Derecha / Pedal en pantalla) y hacia atrás (A / Flecha Izquierda / Pedal en pantalla).
- 🛹 Rampa de Gran Salto:
- Diseñada con geometría de polígonos convexos en Matter.js para impulsarte por el aire hacia tus objetivos.
- 🧱 Demolición de Muros con Física de Ladrillos:
- En el camino hay muros compuestos por ladrillos de impacto independiente. Al chocar contra ellos a gran velocidad, los ladrillos reaccionan con inercia, colisiones y escombros realistas.
- 🧨 Ladrillos de Dinamita TNT:
- Al impactar un bloque rojo de TNT, desatarás una violenta onda expansiva radial que destruye estructuras vecinas.
🎮 Modos y Progresión Extra
- 🏁 6 Escenarios Diferentes: Desde el muro simple inicial hasta grandes búnkeres con fosos de lava hirviente y anillos flotantes de acrobacia.
- ⚙️ Taller y Garaje de Mejoras: Desbloquea 5 bestias rodantes (Monster Truck, Deportivo, Blindado Dozer, Moto Acrobática y Tanque Goliath) y mejora su motor, peso, cohetes nitro y tracción de neumáticos con las monedas que ganas destruyendo ladrillos.
- 🛠️ Modo Sandbox: Personaliza el ángulo de inclinación de la rampa, su altura, la distancia de la pared, la gravedad y los materiales (madera, piedra, cristal o puro TNT) para crear tus propias pistas de choques.
- 🔊 Sintetizador de Sonido Procedural: Efectos de sonido en tiempo real para el rugido del motor V8, explosiones de dinamita y recolección de monedas sin depender de archivos de audio externos.
Files built: src/types.ts, src/utils/audio.ts, src/data/vehicles.ts, src/data/levels.ts, src/data/achievements.ts, src/components/Navbar.tsx, src/components/HowToPlayModal.tsx, src/components/AchievementsModal.tsx, src/components/LevelSelectModal.tsx, src/components/GarageModal.tsx, src/components/SandboxModal.tsx, src/components/GameCanvas.tsx, src/App.tsx, index.html, src/index.css