
Build a single-file index.html game inspired by Five Nights ...
Prompt
Build a single-file index.html game inspired by Five Nights at Freddy's (FNAF) using HTML5 Canvas, Web Audio API, and vanilla JavaScript. The game must include: Office View: Smooth horizontal mouse-edge panning, left and right doors with toggleable door controls and hallway light buttons. Power & Battery Logic: 100% total power. Dynamic power usage rate (1 to 5 bars) based on active lights, closed doors, and camera usage. At 0% power, trigger a blackout state, disable controls, play a music box tune, and trigger a delay before a Freddy jumpscare. Camera System: Lower-screen hover monitor toggle. A 2D minimap with clickable camera nodes (Show Stage, Dining Area, Pirate Cove, Hallways). Render visual static noise over canvas feeds and display dynamic animatronic position overlays on specific cameras. Animatronic AI & Pathfinding: Bonnie: Aggressive; moves along the West Hall path. If at the left door while light is off, triggers jumpscare after 5 seconds unless door is closed. Chica: Moves along the East Hall path; causes kitchen audio cues when in position. Foxy: Hidden in Pirate Cove with 4 visual progression stages. Sprints down the West Hall if unmonitored; drains extra power if stopped by a closed door. Freddy: Moves in darkness; slower movement steps, only advances when monitor is down or not viewing his current camera. Night Progress & UI: 12 AM to 6 AM timer (80 real-time seconds per hour). Display night numbers (Night 1β5) with scaling AI aggression parameters (0 to 20 scale). Include game over screens, a 6 AM win screen, and audio effects for ambient fan hum, light buzzes, door slams, footsteps, and jumpscares."
A system prompt was added to support web rendering