I'll build a polished match-3 ("три в ряд") game with canvas rendering for smooth 60fps animations, particles, and screen shake. Let me start by exploring the project structure.
Now I have a clear picture. I'll build a canvas-based match-3 game with:
- Engine module handling grid, matches, animations, particles, screen shake
- React
App for UI (menu, HUD, pause, game over, high scores)
- Keyboard (arrows + space) and touch/mouse (tap or swipe) controls
- Neon-themed cohesive palette
Let me create the game engine first, then the React shell.
Now let me create the React App component with all the UI states (menu, HUD, pause, game over, high scores).
Now let me update the title and run the build.
Now let's build to verify everything compiles.
Build is clean. Let me quickly review one potential issue: the settle → swap transition. After removals, I re-enter the "swap" phase which then calls findMatches. But if the newly-falling gems form matches at the top, they might not be in their final positions yet — the phase waits for !anyMoving, so that's fine. Good.
One issue: after a "no match" swap-back, pendingUnswap is cleared and we go to phase="swap", but on next tick when animations finish, findMatches runs on the already-reverted board (likely no matches). Then pendingUnswap is null so we go to idle. Good.
Let me also verify the game handles the case where the initial start binding I did in the useEffect isn't broken — actually I did engine.start = engine.start.bind(engine) which is unnecessary and could confuse. Let me remove it and also ensure the render loop starts properly so the board shows on the menu screen too.
Let me add a background to the game area so it looks polished even before starting.
Now let me build again to confirm everything still compiles clean.
Build passes. Here's a summary of what I built:
Три в ряд — Match-3 Game
Architecture
src/game/engine.ts — canvas-based game engine (grid state, matches, cascades, tweens, particles, screen shake, input adapters)
src/App.tsx — React shell with menu, HUD, pause, game-over overlays and local high-score storage
Core loop (fun in 10 sec)
- 60-second timer with +time bonuses per match keeps the pace tight
- 8×8 grid with 6 distinct gem types (heart, diamond, hex, star, circle, triangle) — each color-coded AND shape-coded for accessibility
- Cascade multiplier stacks (x2, x3…) with bonus time
- 4-in-a-row → 60/gem, 5-in-a-row → 100/gem, all multiplied by combo depth
Controls
- Keyboard: arrow keys move the dashed cursor, Space/Enter selects, then arrows swap in that direction; Esc/P pauses; Enter restarts
- Touch/mouse: tap a gem then tap an adjacent one to swap, OR flick/swipe in any direction
Juicy feedback
- Screen shake scaled to combo depth
- Explosive particle bursts colored per gem type with glow
- Floating "+score / xN" texts with easing
- Background radial pulse on each match
- Gem pop-in (back-out ease), squash on removal, smooth spring toward target position
- Golden pulsing selection ring; dashed keyboard cursor
- Invalid swaps auto-revert with a tiny shake
States
- Menu: shimmering title, gem strip, "Play" CTA, tip cards, top-5 leaderboard
- Playing: time bar (green→yellow→red), score, best combo
- Paused: instant Resume/Restart with kbd hint
- Game Over: score summary, hi-score name entry (12 chars, persisted), leaderboard highlight, one-click restart
Perf
- DPR-capped canvas, single rAF loop, frame-independent updates with dt clamp
- All animations tween via delta — smooth 60fps on desktop and mobile
- Touch-scroll prevention over the canvas so mobile swipes don't scroll the page
Files built: src/game/engine.ts, src/App.tsx, index.html