I'll research the game first to understand its mechanics, then build an arrow escape H5 game.
Now I have a clear understanding of the game mechanics. Let me check the existing project structure.
Now I'll build the game. Let me plan the implementation:
Game: Arrows – Puzzle Escape (H5 version)
Core mechanics:
- Grid of arrows pointing in different directions (up, down, left, right)
- Player taps/clicks an arrow to extract it — it slides out in the direction it points
- An arrow can only move if the path from it to the edge of the grid is clear (no other arrows blocking)
- Goal: extract ALL arrows without any collisions
- Hearts system: wrong moves lose hearts
- Multiple levels with increasing complexity
Let me create the game files:
Now let me create the game logic and levels:
Now let me create the game engine hook:
Now let me create the main App component with all the game UI:
Let me fix the unused import and add the CSS animations:
Now let me add the CSS animations:
Now let's try building:
The build succeeds. Now let me review the game to make sure everything works properly. Let me check a few things:
I notice a potential issue with the clickArrow function - it uses hearts in the closure, but since it's inside setArrows, this might cause stale state issues. Let me also check a potential issue where arrows that are animating (but not yet removed) should still show in the grid. Let me review and fix the grid rendering and the game state logic:
Let me look at the grid rendering logic more carefully to fix the animating arrow visibility:
I see that the grid building logic filters out removed arrows but should also show animating ones. Let me fix the grid building to include animating arrows:
Now let me also fix the stale closure issue in the clickArrow function. The hearts value might be stale inside the setArrows callback:
Now let me also add a subtle visual indicator for arrows that can be moved (a gentle glow), and improve the mobile experience. Let me also add sound effects using the Web Audio API for a more engaging experience:
Now integrate sounds into the game hook:
Now I need to actually use the sounds. Let me update the clickArrow function to play sounds:
Good. Now let me enhance the App.tsx with a subtle glow indicator for moveable arrows and improve some visual details:
Now let's add some particle effects and a nicer grid background. Let me also add a hint button feature. Let me also add some decorative elements to the game board:
Now let me add a hint system. I'll add it to the game hook and display a hint button in the game UI:
Now update App.tsx to use the hint system and show the hint indicator:
I need to add onHint and hintArrowId to the GameBoard props:
Now update the ArrowCell to show hint highlight, and update the GameBoard component usage:
Update ArrowCell to accept isHinted prop and show GameBoard with the new props:
Now use the isHinted in the button style:
Now I need to pass the new props to GameBoard:
Now let's build again to check for errors:
The build succeeds. Let me now review the complete flow to make sure everything is polished. Let me check a potential issue with arrows that are on the edge — they should always be able to move in their direction toward the edge:
The path checking logic looks correct. An arrow at the edge with no arrows between it and the exit will return true (no iterations in the loop).
Let me also verify that the levels I created are actually solvable. The key constraint is that at every point during the game, there must be at least one arrow that can be removed. Let me review a couple of the early levels:
-
Level 1: 3 arrows at (0,2,right), (1,0,left), (2,1,down). Arrow at (0,2) points right - col 2 is rightmost in 3x3, no arrows to the right. Arrow at (1,0) points left - col 0 is leftmost. Arrow at (2,1) points down - row 2 is bottom. All three can be removed in any order. ✓
-
Level 2: (0,1,up), (1,1,right), (1,2,right). Arrow at (0,1) points up - row 0, top edge, clear. Arrow at (1,2) points right - col 2, right edge, clear. Arrow at (1,1) points right - but (1,2) blocks. So must remove (0,1) or (1,2) first, then the rest. ✓
Looks good. Let me also make the grid sizing more responsive for mobile devices. The current calculation might be too small on some devices:
Now let me add a nice background pattern to the game board and polish some final details. Let me also add a particle/confetti effect on level completion:
Now integrate the confetti into the App:
Now add Confetti to the level complete overlay:
Let me add some additional CSS for a nice background grid pattern:
Add the grid pattern to the main game container:
Let me do a final build:
Build succeeds! Let me do one final review of the complete code to ensure everything is polished:
Everything looks good. Let me verify the final part of the file:
Let me do one final build to confirm everything compiles cleanly:
The game builds successfully. Here's a summary of what I built:
箭矢逃脱 (Arrow Puzzle Escape) - H5 Game
Game Overview
A minimalist logic puzzle game inspired by the "Arrows – Puzzle Escape" app. Players must extract arrows from a grid by clicking them in the correct order.
Core Mechanics
- Grid-based puzzle: Each level presents a grid filled with directional arrows (↑↓←→)
- Arrow extraction: Click an arrow to make it fly out in the direction it points
- Path must be clear: An arrow can only be extracted if no other arrows block its path to the grid edge
- Wrong moves lose hearts: 3 hearts per level; clicking a blocked arrow costs one heart
- Level progression: 50 levels (20 handcrafted + 30 procedurally generated), increasing in grid size and complexity
Features
- 🎨 Beautiful dark theme with color-coded arrows (violet=up, amber=down, cyan=left, emerald=right)
- ✨ Smooth animations - arrows fly out with direction-specific animations, shake on wrong clicks
- 🎵 Sound effects via Web Audio API (slide, error, and success sounds)
- 🎉 Confetti celebration on level completion
- 💡 Hint system - highlights a moveable arrow with a golden pulse
- ❤️ Heart/life system - 3 hearts per level
- 📊 Progress tracking - score counter, progress bar, remaining arrows
- 🔓 Level unlock system persisted in localStorage
- 📱 Fully responsive - works on mobile and desktop
- 🎯 Visual indicators - moveable arrows have a subtle ring glow, blocked arrows appear slightly dimmed
File Structure
src/App.tsx - Main game UI with all screens (Menu, Level Select, Game Board, Overlays)
src/useGame.ts - Game state management hook with all game logic
src/types.ts - TypeScript type definitions
src/levels.ts - 50 levels (20 handcrafted + 30 procedurally generated)
src/sounds.ts - Web Audio API sound effects
src/Confetti.tsx - Confetti particle animation component
src/index.css - Custom CSS animations (fly-out, shake, pulse)
Files built: index.html, src/types.ts, src/levels.ts, src/useGame.ts, src/App.tsx, src/index.css, src/sounds.ts, src/Confetti.tsx