I'll build a polished top-down zombie extraction shooter. Let me start by exploring the project structure, then plan the implementation.
Let me plan the architecture:
- Core game: Canvas-based rendering with a game loop using requestAnimationFrame
- Controls: WASD/arrows for movement, mouse/touch for aiming and shooting
- Gameplay: Kill zombies, collect XP/extraction items, survive waves
- Juice: Screen shake, particles (blood, muzzle flash, explosions), hit flashes
- States: Start, playing, paused, game over with high-score table
- Visual theme: Dark apocalyptic with neon/green accents
Let me start by exploring the project.
Let me examine the current files to understand the setup.
I have a clear picture of the setup. Tailwind v4, React 19, Vite with singlefile plugin. Let me plan the game architecture.
I'll build a complete zombie extraction shooter with:
Architecture:
src/game/engine.ts - Core game engine (loop, entities, physics, particles)
src/game/types.ts - Shared types
src/App.tsx - React shell with game states (start, playing, paused, gameover)
src/game/highscores.ts - Local high-score management with localStorage
Game design:
- Player moves (WASD/arrows), aims & shoots (mouse/touch with twin-stick on mobile)
- Zombies spawn in waves, chase player, deal contact damage
- Extraction points spawn — reach them to survive/extract (the "extraction" loop)
- Kill zombies for points/xp, rewarding risk
- Juice: screen shake, blood particles, muzzle flash, hit feedback, damage vignette, kill popups
- Run at 60fps with object pooling and capped delta-time
Let me build the game. I'll start with the high-score utility and types, then the engine, then the React shell.
Let me create the files. First, the types and high scores.
Now the high-score management utility:
Now the core game engine. This is the biggest and most important file. It handles the game loop, entity updates, rendering with screen shake, particles, and all the juice. Let me write it carefully for performance (object pooling where reasonable, capped delta time, and batched canvas draw calls).
Let me fix the type errors. Also, I notice I have some odd leftover code in the player rendering and a broken bit in drawPlayer. Let me clean up the engine. Let me look at the specific issues - unused imports, unused parameters. Also I notice I duplicated some ctx logic weirdly. Let me fix these.
Let me fix the resetGame function and the remaining unused parameters. The resetGame has a weird signature. Let me simplify it.
Now let me find and fix the remaining two issues. Line 724 is in drawVignette and line 1033 is drawReticle. Let me look at those.
I see - there's a duplicate/wrong line at 724 and a weird scale. Let me fix the drawPlayer beginning to remove the broken { ctx } destructure and the doubly-weird scale.
Now the last error - drawReticle's s parameter. Let me look at that function.
I need to fix getCtx (unused s param) and the drawReticle/drawPlayer usage. Actually, having a module-level CTX holder is awkward — it requires the render loop to set it before calling render. Let me instead refactor to pass the ctx explicitly through render functions. That's cleaner and avoids the mutable global state.
Let me rework this properly. I'll change the render functions to accept a ctx parameter throughout and remove the getCtx/setCtx mechanism. Let me update each draw function signature.
First, fix getCtx and collectGarbage:
Now I need to refactor all the draw functions to use the ctx passed via a ctx parameter. I removed getCtx, so I'll change each function to receive ctx from the caller. The cleanest approach: change each draw function from function drawX(s: GameState) to function drawX(s: GameState, c: CanvasRenderingContext2D) and update the calls in render().
Let me update render() first to pass ctx, then each function. Let me read the render function and the draw functions.
I'll update the render function to pass ctx to each draw function, and update each signature. Let me update the render function calls:
Now I need to update each function signature. Let me update all of them to accept a c: CanvasRenderingContext2D parameter and replace the getCtx(s) line. Let me do these edits. They're in drawPlayer (line ~724), drawZombies (~802), drawBullets (~868), drawExtraction (~890), drawParticles (~933), drawPopups (~964).
Now let me fix drawZombies, drawBullets, drawExtraction, drawParticles, drawPopups signatures. Let me look at each.
Let me see the function definitions for each of these to update their signatures. Let me read just above each line:
I'll update all five function signatures and remove their getCtx/if (!c) return lines in separate edits. Let me do them all:
All the lint errors from the last three edits are resolved. The remaining errors were from intermediate states. The final message shows "Edited src/game/engine.ts." with no errors for the last edits. But the first edit's message still showed errors at lines 676, 680, 681, 884, 927, 958 — those were before the subsequent edits ran. Let me verify no remaining errors exist now by checking the whole engine file compiles. Let me check for any remaining getCtx references and verify the duplicate-edits didn't leave artifacts.
All the draw functions have been updated consistently with ctx passed as a parameter. The engine file is now clean. Let me verify there are no more type errors by building the engine. Actually, let me check the drawExtraction function still references e correctly and the drawReticle function is fine. Let me also double check there are no other type errors. Let me run a quick grep for the player render - there was an earlier issue. Let me verify the whole engine compiles by checking drawExtraction - it uses e.maxLife which exists in the Extraction type.
Let me check the drawReticle function - it still uses s and g, which is fine since I didn't remove that. Let me verify build status by checking remaining potential issues. The extraction draw now uses c (ctx param). Good.
Now let me create the main App component with the React shell, game loop, controls, and UI overlays. This is the biggest remaining piece besides verifying the engine. Let me first verify the engine builds cleanly by doing the build, but I still need App.tsx. Let me create the App component.
Let me think about the App structure:
- A canvas that fills the screen (full viewport)
- A game loop running via requestAnimationFrame that calls
step and render
- Keyboard controls: WASD/arrows move, mouse aims, hold to fire (or auto-fire)
- Touch controls: twin-stick — left half of screen is move joystick, right half is aim/fire joystick. When touching right side, auto-fire.
- HUD overlay (React) showing score, wave, HP, extraction timer, wave indicator
- Overlays for menu, pause, game over with high scores
For the game loop, I'll draw the HUD info in React state updated at a throttled rate (or just update every frame via a ref to avoid re-render, using DOM updates). To keep 60fps, I'll minimize React re-renders. I'll update HUD via a useState that updates a few times per second for the numbers, OR draw HUD in canvas. Drawing HUD in canvas is most performant. But React overlays are easier for menus/game over.
Hybrid approach:
- Canvas renders the world + a canvas-based HUD (score, wave, hp bar, extraction timer).
- React overlays handle menu, pause, game over screens (which don't need per-frame updates).
Actually, let me keep score/wave/hp in React but update them through refs updated each frame and a low-frequency setState (~10fps) to avoid perf cost — no, that causes jitter. Better: draw the in-game HUD onto the canvas each frame, and keep React for full-screen overlays only. I'll pass latest state via refs for the game-over screen.
Let me get the canvas ctx, resize with devicePixelRatio for sharpness but cap DPR for mobile perf (e.g., max 2, and maybe lower resolution on very high-DPR for perf). Actually for 60fps on mobile, I'll cap DPR at 1.75 or use a scale factor. Let me use DPR capped at 2, but on large screens maybe reduce. I'll use a quality scale = min(devicePixelRatio, 2).
Let me write App.tsx. I'll structure it with:
- Refs: canvasRef, stateRef (holds current GameState), rafRef, lastTimeRef
- useEffect: setup canvas, listeners, game loop
- React state:
ui object { phase, score, wave, kills, hp, extraction } updated at ~8-10Hz for overlay animations; plus menu/gameover data
Actually simpler: use React state updated each animation frame but with React 18 batching - that's a re-render every frame which for this small tree is OK, but can be janky. Let me use a low-frequency sync: I'll update HUD numbers via direct DOM manipulation through refs when playing, which avoids React re-renders entirely during gameplay. That's the most performant.
Let me write it with a HUD updated via refs to specific DOM elements (score, wave, hp bar width). This keeps 60fps.
Let me build it now.
I have a few lint errors and a problematic isTouchDevice issue. I declared isTouchDevice as a local const state but referenced it globally in GameOver. Let me clean up:
- Remove unused
WORLD_H, WORLD_W imports
- Remove unused
hudHp variable
- Fix the
isTouchDevice global declaration — I need to actually use the one from App scope. Since GameOver is a separate component, I'll pass it as a prop instead.
Let me fix these.
Now fix the isTouchDevice global. I used isTouchDevice in GameOver but it's not available there. I need to pass it as a prop. Let me update the GameOver usage and signature, and remove the declare const isTouchDevice guard.
I need to add isTouch prop to the GameOver component signature and remove the global declare.
Now I need to use isTouch in the GameOver body instead of the global isTouchDevice, and remove the declare const isTouchDevice line.
Now remove the declare const isTouchDevice: boolean; line that's no longer needed.
No more type errors reported. Now let me address the PAD const which I used in a weird way ({PAD && "auto"} - that was a hack that doesn't work). Let me clean that up. Also the hint text for touch controls. Let me fix that.
I need to remove the unused PAD constant.
Now let me set up the styles. I need a custom font (Rajdhani, referenced in the canvas drawing code) and the font-display utility class for Tailwind v4. Let me update index.css and index.html.
First index.html - update title and add font + meta for mobile (prevent zoom on double-tap, fullscreen-friendly):
Now update index.css to define the font-display utility, set base styles, prevent overscroll on mobile, and handle the full-height viewport.
Now let me build the project to check if everything compiles.
The build succeeds. Now let me review the gameplay logic carefully to make sure the "fun in first 10 seconds" and extraction loop work correctly. Let me re-read the key parts of the engine to spot issues.
Key concerns:
-
First wave: The game starts with wave = 0, waveDelay = 3.5. In updateWaves, a wave spawns only when zombies are cleared and waveDelay expires. But on a fresh game there are no zombies, so s.zombies.length === 0 is true, and waveDelay counts down from 3.5. That means the first 3.5 seconds there's nothing happening — bad for "fun in 10 seconds." I should spawn the first wave immediately, and give a short "wave incoming" prompt. Let me spawn the first wave quickly.
-
Extraction spawns only after a wave is cleared (startExtraction is called inside updateWaves only when initializing a new wave). Actually I call spawnExtraction(s) every time a wave spawns. But I also want an extraction active from the start so the player has an immediate goal. Let me make the first wave + extraction appear right away.
-
Camera aiming on desktop: I need a starting direction. On desktop, useKeys is false, mouse aims. Good.
-
setControl type guard: I only allow the 4 movement keys. Fine.
-
The hudScore/hudWave variables are unused effectively — harmless but let me not worry.
-
For touch, s.controls.useKeys = isTouch is set in setPlaying. But when the game first mounts, isTouch may differ. Also, mouse is disabled for touch. Good. But on desktop, useKeys=false so mouse aiming works. However, when useKeys is false but there's no mouse yet (touch?), the aim defaults to angle 0. Fine.
Actually wait — there's a subtle bug. For touch devices I set useKeys = true, and in step's updatePlayer, when useKeys is true, the angle is derived from aimX/aimY. But in the touch handler for the right stick, I both call setAim AND manually set player.angle. That's fine — updatePlayer will just recompute the same thing when useKeys is true. Actually when useKeys is false (desktop), I manually set angle in the mouse handler AND updatePlayer skips angle computation (because it only computes when useKeys). Good, consistent.
But on desktop I want the player to auto-aim toward mouse; I set angle in mousemove and in updatePlayer if (c.useKeys) block does nothing. Good.
Let me reconsider: the useKeys naming is confusing. useKeys=true = touch twin-stick (aiming via virtual aim point). useKeys=false = desktop mouse aiming. Either way setAim is called and, in the useKeys branch, angle is derived from aim. In the non-useKeys branch, angle set externally. Consistent.
Let me fix the first-wave timing. I want:
- On new game, immediately spawn wave 1 and first extraction (goal from second one).
- Show a brief "(1) WAVE INCOMING" popup.
Let me modify newGame/createGame to trigger first wave. Actually the cleanest: in step, on the very first frames while s.wave === 0, spawn wave + extraction immediately. Let me add that.
Also I realize the wave-clear logic: updateWaves only counts down waveDelay when zombies.length === 0. When a wave spawns it sets waveDelay. After the player clears all zombies, waveDelay counts down then spawns next wave + new extraction. That's a good "wave cleared then brief rest then next wave" loop. Good. But the extraction timer is independent and ticking down—if the player clears a wave they get a new extraction. The extraction has its own countdown (20s+). Good tension.
However, there's a subtle issue: when the player reaches extraction and it clears, s.extraction = null. Then in updateWaves, since there may still be zombies, nothing spawns until all cleared and waveDelay expires. Good.
But if the player extracts and no zombies remain, updateWaves immediately starts the next wave (good). But they should get a fresh extraction too.
Let me improve: spawn first wave immediately. Let me edit newGame.
Let me also reconsider the difficulty ramp and making sure zombies actually engage within the first seconds. Since they spawn at world edges (2000x1400) and chase at speed 78, from the corner they might take a while to reach the player even at 2-3 seconds. That delays "action." I should spawn the first wave close-ish. For wave 1, spawn zombies at a medium distance from the player.
Let me improve pushZombieFromEdge to, for wave 1, place some zombies at a closer distance around the player. Actually simpler: spawn first batch around the player at radius ~300-500 so there's immediate threat. Let me add a "ring spawn" for the first wave.
Let me make these gameplay improvements. First, modify newGame to kick off wave 1 and extraction immediately.
Now let me modify spawnWave to make wave 1 place some zombies in a ring around the player for immediate action, and the rest from edges. Let me update spawnWave:
Now I need to make sure the wave indication is visible. Let me add a "WAVE n" popup when a wave spawns. Let me also add it in spawnWave:
Now, there's an important concern with the extraction timer and wave clearing. The extraction is spawned alongside a wave. But the player may want to extract before clearing a wave. That's fine — extraction clears nearby zombies (radius 260) and gives a bonus.
However, there's a scenario: extraction timer expires while zombies still alive → "EXTRACTION LOST" → then next extraction comes only after wave cleared. So the player must clear the wave to get another extraction chance. That's good design (must survive the wave and extract). Good.
Now, one concern: with spawnExtraction called in updateWaves immediately when spawning a wave, but ALSO the extraction is 'active'. If the player extracts mid-wave, then zombies remain. They clear rest, waveDelay counts, next wave + new extraction. Good.
Let me build and verify no errors, then review rendering for correctness. Let me also double check the blur handler - I registered window.addEventListener("blur", ...) with an inline function but cleanup removes togglePause (wrong reference) — so cleanup won't remove the blur listener. Minor leak but only on unmount/full app, and the listeners are added once on mount. Since the app never unmounts the effect, this is a one-time leak on component unmount only. Acceptable but let me fix it to be clean.
Let me fix the blur listener cleanup.
Now there's a subtle but important issue: the useEffect that sets up the game loop captures setPlaying, togglePause, handleGameOver, setPhase from the initial render. These are all stable via useCallback, so that's fine. But phaseRef is used inside the loop and updated on each render — good.
Now let me reconsider one bug: in handleGameOver, I set uiRef and call collectGarbage. The game-over detection in the loop checks s.phase === "gameover" && phaseRef.current !== "gameover". When does s.phase become "gameover"? In step() when player HP hits 0. But step is only called when s.phase === "playing". So once HP hits 0, step sets phase to "gameover". Next animation frame, the loop sees s.phase === "gameover" and calls handleGameOver. Good. But step returns early if phase !== "playing", so it won't run again. The render still runs. Good.
Wait, there's an issue: step sets s.phase = "gameover" but handleGameOver is only triggered via the phaseRef check. However, if I pause the game (phase "paused"), HP can't go to 0 in step since step only runs in "playing". Fine.
Now, let me think about a critical rendering issue: On desktop, the player must aim using the mouse, and firing requires holding mouse down. But setFiring is only set true on mousedown when phase is "playing". After starting via the menu (mousedown on PLAY), phase becomes "playing" via setPlaying inside onMouseDown. But the same mousedown event — does it also set firing? The order: in onMouseDown, if phase was "menu", it calls setPlaying() and returns. So the click that starts the game doesn't fire. Good. Next mousedown fires. Good.
But there's a subtle issue: when clicking PLAY, setPlaying sets phase via setState (async), but also sets s.phase = "playing" synchronously on the state object. Good, because I update both the ref's phase and React state. Actually setPlaying does s.phase = "playing" then setPhase("playing"). Good.
Now, does the canvas receive mousedown when clicking the PLAY button overlay? The overlay is a div on top of canvas with pointer-events default. The mousedown on the button is handled by the button, not the window mousemove/down? Window-level mousedown listener will fire for clicks anywhere including on the button. So onMouseDown fires, phase is "menu" (React state) but stateRef.current.phase — was it "menu"? After setPlaying sets s.phase = "playing" synchronously before the window handler... no, the order: the button's onClick handler (setPlaying) and the window mousedown both fire. The window mousedown fires during the capture/bubble of the SAME mousedown. Depending on order, stateRef.current.phase might already be "playing" by the time window handler checks. Actually React's onClick is attached to the button element; the window "mousedown" listener is a native listener on window. Event propagation: mousedown on button bubbles up to window. React 18 attaches listeners at the root. The native window listener would fire during bubbling. Inside onMouseDown: if (s.phase === "menu") — stateRef.current.phase is still "menu" because setPlaying was triggered by the click's onClick which fires on mouseUP (click event), not mousedown! Click = down+up. So on mousedown, the window handler runs first while phase is still "menu" → calls setPlaying(). Then on mouseup, the button's onClick also calls setPlaying (double). Harmless (idempotent-ish; setPlaying resets game again). Minor: restarts game on menu click but fine. Actually it could reset twice but both same result. Acceptable.
Actually wait, will onMouseDown preventDefault? No, good, the button click still works.
OK. Now let me also verify: when phase is "gameover" or the overlay covers screen, the canvas still gets rendered behind. Good.
Now let me reconsider potential performance: object pooling not implemented, but I cap particles at 700 and bullets at 180, zombies at ~90. The arrays use splice which is O(n) but for these sizes fine. Rendering uses fillText and gradients each frame — popups and gradients. Creating radial gradients each frame for body/extraction/vignette is a bit costly but OK. To hit 60fps, acceptable on desktop; on mobile might be slightly heavy but caps DPR at 1.5.
Actually, I should add a background/ground texture feel. Currently the grid is very faint. The vignette darkens. It might look too plain/bare. Let me add some subtle decorative elements — scattered "blood splats" or rubble drawn once to an offscreen canvas for performance, then blit each frame. That improves visuals a lot without per-frame cost.
Let me add an offscreen surface for ground decorations that's drawn once and composited. I'll generate it on first render. Since the world is 2000x1400, an offscreen canvas of that size might be memory-heavy on mobile but it's one-time. Let me generate a lighter version: a pattern of dark patches and cracks in a smaller repeating tile, or just draw decorations procedurally each frame but limited.
Actually, a 2000x1400 offscreen canvas = 2.8M pixels *4 = ~11MB, and at DPR not scaled (world-space). Drawing it each frame via drawImage at 1:1. That's OK memory-wise for desktop but on mobile 11MB is fine too. But generating it each new game adds a tiny cost. Let me generate it once and cache it module-level, reusing across games.
Let me add a ground decoration layer: dark pits, rubble, grime, and faint bones. Plus a subtle hazard. This adds cohesion to the theme.
Let me write a function that builds the ground layer lazily and caches it. I'll call it in render before drawing grid.
Let me add this to the engine.
I have an unnecessary getGroundCanvas wrapper. Let me simplify - just call drawImage(getGround(), 0, 0) directly.
Now let me build again to confirm everything still compiles.
Build succeeds. Now let me add the in-game HUD (score, wave, HP) drawn on canvas so the player sees their score and health during gameplay without React re-renders. I'll add a HUD render function called in render after drawVignette (screen space).
Let me also add a starting direction/aim for desktop so movement isn't awkward. Let me look at how the player starts: angle 0 (pointing right). Fine after mouse moves.
Let me add the HUD rendering. I'll add it to the render function. Let me add a drawHUD function that shows score top-left, wave top-center, and a health bar top-left under score. Also an extraction direction indicator/distance when extraction is active (helps the player find the goal).
Let me add this to the engine.
I overcomplicated the arrow math with unnecessary helper functions. Let me clean it up - remove the unused ang variable and the helper functions.
Now remove the unused helper functions at the end:
No type errors. Let me build to confirm.
Build succeeds. Now let me review a few more gameplay/UX issues:
-
Extraction timer vs wave clear unlocks: My HUD says "Clear the wave to unlock extraction" when no extraction active. Good.
-
Player death by extraction timer expiring while player not there → extraction lost, score penalty. Good.
-
Let me reconsider the damage display: when the player runs out of HP, step sets gameover. Good.
-
The updateWaves only counts down waveDelay when zombies cleared. But on a fresh game (wave 1), I spawn both wave and extraction in newGame. The updateWaves will then wait for wave 1 to be cleared. The extraction timer runs independently. Good.
-
Potential issue: spawnExtraction is called in newGame AND the first updateWaves won't spawn again until wave cleared. But if the player is slow, after clearing wave 1, updateWaves spawns wave 2 + a NEW extraction (overwriting—but the old one may still be active/timer going). Actually spawnExtraction just replaces s.extraction. If the player cleared all zombies, the previous extraction may have expired → null, or still active. Either way wave 2 spawns a fresh extraction with full timer. Good.
-
Let me make sure zombies don't spawn inside the player causing instant damage. They spawn at edges or 300+ away, fine.
-
Touch joystick movement: The movement maps to world-relative via camera. Since movement is relative (wasd-style re-mapped to left/right/up/down), and camera follows player, the direction is screen-based, which is correct for twin-stick. Good. The wx/wy computations in the move branch are unused (void). Fine.
Let me reconsider the touch auto-fire: when player touches right side, setFiring(s, true). As long as a right-stick touch is held, firing continues. Move your finger, it stays firing. Lifting stops. Good. But setFiring for mouse sets on mousedown and setFiring(false) on mouseup. But the touch touchstart with moveStick=false sets setFiring(s, true) — but fires only when phase playing. On menu, it calls setPlaying which starts the game, but doesn't set firing. Good.
Now, an issue: on touch, useKeys=true and in updatePlayer, after movement, if (c.useKeys) does angle from aim. But initially aimX=aimY=0 → angle = atan2(-playerY, -playerX). Combined with auto-fire not yet active, fine.
Let me also handle: when using mouse on desktop and the game starts, the player should not auto-fire until clicked. Good — firing only on hold.
Let me now reconsider the "fun in first 10 seconds": Wave 1 spawns 6+5 zombies in a ring at 300/430 distance with speed 78. They'll reach the player in ~4-6 seconds. First extraction spawns ~430-900 from player. So the player immediately sees enemies and a beacon. Shooting starts as soon as they aim (mouse). Feels good.
Let me add a tiny bit more juice: a kill streak / combo system and a screen-flash on extraction. Also, let me make weapon firing feel snappier by adding a slight bloom. Actually the current feel should be OK. Let me focus on polish.
Let me reconsider one thing about performance at high zombie count: updateBullets loops bullets × zombies (nested) → at 90 zombies and 180 bullets, that's 16200 checks/frame worst case. That's fine actually. But typically few bullets on screen. OK.
Now, let me reconsider the camera smoothing on touch aim: The right stick sets player.angle using s2.player.angle = atan2(...) directly, and also setAim. In updatePlayer, since useKeys=true, it recomputes angle from aimX/aimY anyway (same). Fine.
Let me make the player visible relative to aim—there's a subtle issue: on desktop the player aims at mouse; the gun points at mouse. Good.
Let me now verify the damage circle / contact and that zombies can actually reach the player and damage. Player radius 15, speed 235 (faster than all zombies: max runner 132). So player can kite indefinitely. That's good for survival skill. Runners (type 2) are fast. Contact damage with 1s iframe means at most ~1 hit/sec per zombie source, but many zombies → lots of hits. With maxHp 100 and 12 damage each, if surrounded by ~6 zombies you take ~72 damage/sec → deadly quickly. Good tension.
Now let me reconsider: is there any instant-death at wave 1? 11 normal zombies at 12 damage, iframe 1s. If all 11 are touching, that's 132 dmg in the first iframe-second... but iframe prevents multi-hits within the same player-invulnerable window? Let me check: I set pl.invuln = 1.0 on first hit, and only apply damage when pl.invuln <= 0. So after first hit, invuln=1, no more damage for 1s. So max ~1 hit/sec regardless of zombie count (until invuln fades). With 6+ zombies alternating... within 1s only one hit applies then invuln resets. So effective DPS from horde is capped near one hit per second = 12 dmg/sec at wave 1. With 100 HP, that's survivable for ~8s while surrounded. Kiting matters. This is fine and not instant-death. Good.
Actually wait — that means being surrounded by 20 zombies isn't much more dangerous than 2 (DPS capped). That makes survival too easy. Hmm. For an extraction shooter, mobs should pressure you. But capping via iframe every 1s is a common approach. Let me reduce iframe to 0.6s and make it so each zombie has its own stagger... but that complicates. Alternatively, keep single global iframe but shorter. Let me set invuln = 0.6. That doubles pressure. Let me also give the horde knockback to keep separation. Actually let me reduce contact thickness.
Let me adjust: pl.invuln = 0.7; on hit. That triples the pressure vs 1.0. Combined with high hp, gives challenge. I'll set invuln = 0.7.
Let me make that edit.
Now let me add a combo/streak system for extra juice. Let me add a combo and comboTimer to GameState. Actually, let me keep scope manageable but add a kill-streak multiplier that rewards aggressive play. Let me add these to the state type and engine.
Let me add combo and comboTimer to GameState type and wire it into killZombie for bonus score popups.
I need to initialize these in createGame. Let me add them.
Now let me wire the combo system into the update. I'll add combo decay in step and combo scoring in killZombie. Let me add combo decay and integration. First, let me add combo timer decay to step:
Let me add the updateCombo function and modify killZombie for combo scoring. Let me add updateCombo near the other update functions.
Now let me modify killZombie to add combo scoring. Let me read the current killZombie:
Let me find the killZombie function:
Let me read the full killZombie to modify the combo scoring:
Let me modify killZombie to add combo scoring:
Files built: src/game/types.ts, src/game/highscores.ts, src/game/engine.ts, src/App.tsx, index.html, src/index.css