Build a polished, playable browser game: a horror game with extreme stress built to its…
- User
Build a polished, playable browser game: a horror game with extreme stress built to its finest by including jumpscares, screams and blood with awesome graphics . Make the core loop fun within the first ten seconds, with tight controls for both keyboard and touch, and juicy feedback — screen shake, particle effects, and satisfying animations. Include a start screen, a score system, pause and game-over states with instant restart, and a local high-score table. Style it with a cohesive visual theme and make sure it runs smoothly at 60fps on desktop and mobile.
Assistant
I'll build a polished horror survival game with all the juicy feedback you requested. Let me start by exploring the project structure.
Let me plan the game concept: "Don't Look Back" — a top-down horror survival game where you're trapped in a dark asylum. You move with WASD/arrows/touch, collecting candles for light while fleeing from creatures that spawn in the darkness. When they get close, jumpscares trigger with screams. Blood particles on hit, screen shake, flickering flashlight cone.
Let me build it:
Now let's build the audio system and the main game. I'll use Web Audio API for procedural screams/heartbeats (no external files needed).
Now the game engine (canvas-based for 60fps):
Now the React shell with UI (menu, HUD, jumpscare overlay, blood drips, high scores, touch joystick):
Now the main App with all the polish, jumpscares, blood drips, HUD, and screens:
Now let me check the main.tsx and build:
StrictMode will double-mount the game — I should remove StrictMode to prevent double game init (which would break the canvas game loop):
Build succeeds. Let me review a couple of details that could cause issues:
-
In
game.ts, the shake animation on the canvas wrapper is triggered by React key change — but I put it directly on the container. The CSS animation only plays once per key change, so that's correct. But the canvas is inside a container that constantly transforms, which is fine. -
The
onDamageFlashcallback andonShakeboth fire together — good. -
I noticed the
shakeclass always applies; it'll animate on every re-render key change. Good. -
The Joystick component uses touchId which could conflict — but the isMobile check will still let it render (it always renders when playing). That's fine on desktop since no touches will fire.
Let me verify one thing — the
flashFadeinline animation issue. WhenflashKeyis 0 initially, animation is "none". When it changes, animation runs. But if it doesn't re-trigger between changes (React reuses the same DOM node), CSS animation may not restart. Let me fix by using a key:Also, the shake wrapper — because
shakeKeystarts at 0 and updates, but React reuses the DOM. Actually withkey={shakeKey}it forces remount, which is expensive because the canvas remounts too! That would destroy the canvas context. Let me fix that:Actually the real screen shake is done inside the canvas via camera offset — that's the more performant approach and already works. The CSS shake wrapping the canvas would also cause layout thrashing. My change above turned it into a red-flash pulse instead, which is fine and adds juice.
Let me also make sure that on mobile the initial fingertip on the joystick side doesn't intercept the pause button. The joystick check is
< window.innerWidth * 0.55and pause button is atright-6, so that's fine.Let me now also confirm one concern: in the game, when the player takes damage,
onJumpscareis sometimes called ANDplayScreaminside audio, then the App's onJumpscare handler ALSO callsplayScream(1.2). That layers 2 screams — that's actually great for horror.Let me build again to confirm:
Build succeeds cleanly. Here's what I built:
🩸 DON'T LOOK BACK — A Horror Survival Game
Core loop (fun in <10s): You spawn in darkness with your flashlight already illuminating creatures rushing at you. Move to grab glowing candles → they burst light that incinerates nearby monsters in a satisfying blood spray. Immediate action, immediate reward.
🎮 Controls
- Desktop: WASD / Arrow Keys,
P/Escto pause,R/Enterto restart - Mobile: Virtual joystick appears wherever you touch the left side of the screen; big pause button bottom-right
🔥 Juicy Feedback
- Screen shake via camera offset + red pulse flash on damage
- Blood particles — burst on hits with gravity physics, permanent floor splats
- Blood drips cascade down the entire screen after taking damage (CSS keyframes)
- Full-screen jumpscares with 3 hand-drawn SVG ghoul faces (fangs, hollow sockets, bloody tears) that scale, rotate, and glitch in with red glow
- Procedural screams via Web Audio API (layered noise + distorted saw + sub-bass thump)
- Heartbeat that speeds from 60→180 BPM as HP/sanity drops
- Whispers trigger when sanity is low
- Ambient drone + wind loop the whole time
- Flickering flashlight cone with variable range
- Red pulsing vignette intensifies at low HP, hue-shift on sanity meter
- Film grain, scanlines, glitch text for CRT horror aesthetic
🩻 Systems
- HP + Sanity dual meters — sanity drains passively, faster near enemies, restored by candles
- 3 enemy types — Walker (tall gaunt), Crawler (fast spider), Stalker (tentacle horror with big eye)
- Score system — kills, candle pickups, and survival time
- Difficulty ramps — spawn rate & enemy speed increase over time
- Local high-score table (top 10) stored in localStorage with "sign in blood" name entry
- Start / Pause / Game Over screens all with instant restart
⚡ Performance
- Single canvas with
alpha: falsefor fast clears - No canvas remounts on shake (React key only wraps overlay div)
- StrictMode disabled to prevent double game-loop init
- Camera-relative culling for enemies/candles/corpses
- DPR capped at 2, targets 60fps on mobile
Files built:
index.html,src/index.css,src/audio.ts,src/game.ts,src/highscore.ts,src/Joystick.tsx,src/App.tsx,src/main.tsx-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.