Build a polished, playable browser game: 消消乐. Make the core loop fun within the first…
- User
Build a polished, playable browser game: 消消乐. 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
Let me check the existing config files to understand the setup.
Let me explore the project structure then build the game.
Now I have a full picture. Let me build this match-3 game. I'll create 4 files: custom CSS with animations, the game engine hook, the board renderer with particles, and the main App with all screens.
First, let me update the CSS with custom keyframe animations:
Now let me create the game engine hook with all the core logic:
Now let me create the Board component with tile rendering, particle effects, and input handling:
Now let me create the main App component with all screens (start, playing, paused, game over):
Now let me update the HTML title:
Let me build to check for any issues:
The build succeeds. The game is complete! Let me verify the key files are all consistent:
Everything is in order. Here's a summary of what I built:
消消乐 (Match 3 Puzzle Game)
Files Created/Modified:
index.html— Updated titlesrc/index.css— Custom keyframe animations (float-up, pop-in, shimmer, combo-pop, glow-pulse, tile-idle)src/useGame.ts(483 lines) — Complete game engine hooksrc/Board.tsx(289 lines) — Board renderer with particle systemsrc/App.tsx(268 lines) — Main app with all 4 screens
Core Features:
- 8×8 match-3 grid with 7 colorful fruit/candy tile types (🍎🍊🍋🍇🫐🍓🍬)
- Triple input support: mouse (click + drag), touch (tap + swipe), keyboard (arrows + Space/Enter)
- Full async cascade system: swap → match detection → pop animation → gravity → spawn new tiles → re-check (with combo multiplier)
- 90-second timed mode with color-coded urgency bar (green → yellow → red with pulse)
Juice & Polish:
- Screen shake on 4+ matches or combo chains, with decay
- Canvas particle explosions with physics (gravity, drag, glow) on every match
- Floating score numbers that animate upward and fade
- Spring-bounce CSS transitions (
cubic-bezier(0.34, 1.56, 0.64, 1)) for tile movement - Match pop animation (scale to 0 + 180° rotation with ease-in)
- Sound effects via Web Audio API (select click, swap whoosh, ascending match chimes, error buzz, game over melody)
- Combo indicator that pops in with scaling animation
- Shimmer gradient title on start screen
- Glow pulse on selected tile
Game States:
- Start screen with animated emoji row, gradient title, start button, high scores, controls hint
- Playing with HUD (score, timer bar, combo), board, pause button
- Paused with frosted glass overlay, resume/quit buttons
- Game over with pop-in score reveal, "New High Score!" badge, leaderboard, instant restart
Performance:
React.memoon Board to prevent re-renders during shake- Canvas-based particles on separate requestAnimationFrame loop
- Refs for all async state access (no stale closures)
will-change: transformon tiles for GPU compositing- Generation counter to safely cancel cascades on restart
Files built:
src/index.css,src/useGame.ts,src/Board.tsx,src/App.tsx,index.html