2048 Legend - Classic Number Merge Puzzle Game

Seele01-Flash
By
2048 Legend is the ultimate number merging puzzle game that challenges your strategic thinking. Choose from three difficulty levels and merge numbers to reach the highest score possible.

Prompt

MODEL: Seele01-Flash
Please use Three.js to generate a **mobile-first game** with the theme "2048 Legend". Please read the following detailed game design requirements first, and then generate the code accordingly: ### 1. Assets & Environment * **Visual Style:** Minimalist 3D aesthetic using a top-down **Orthographic Camera** to ensure the grid remains perfectly readable without perspective distortion. The design should mirror the logo's color palette: clean white/light gray backgrounds with tile colors ranging from Light Grey (2) to vibrant Oranges (4, 8, 16) and Deep Reds/Golds for higher numbers (2048+). * **Models & Geometries:** * **Tiles:** Use `RoundedBoxGeometry` for tiles to give them a soft, tactile feel (chamfered edges). * **Grid:** A slightly recessed base container with defined slots for the tiles. * **Animations & VFX:** * **Spawning:** New tiles (2s and 4s) should scale up from 0 to 1 (elastic easing). * **Merging:** When two tiles merge, the resulting tile should briefly pulse (scale x1.2 then back to x1.0) and emit a small, simple particle burst (low poly cubes) to provide visual satisfaction. * **Sliding:** Smooth linear interpolation (Lerp) for tile movement. * **Performance:** Use shared geometries and materials where possible. Limit dynamic lights; use a baked-style ambient light setup + one directional light for casting soft shadows to define depth. ### 2. Audio Requirements * **BGM:** A chill, Lo-Fi / Ambient Electronic track. It should be repetitive but non-intrusive, aiding concentration (think "elevator music" but modern). * **Sound Effects (SFX):** * **Slide:** A soft, quick "swish" or fabric friction sound. * **Merge:** A distinct, satisfying "wood block" click or a soft synth pluck. *Creative addition:* Pitch the merge sound up slightly as the numbers get higher (e.g., merging 1024s sounds higher pitched than merging 2s). * **Game Over:** A descending low-tone chime. * **Win (2048):** A bright, uplifting major chord fanfare. * **UI Clicks:** Subtle mechanical clicks for Restart/Undo buttons. ### 3. Gameplay Loop * **Core Mechanics:** 1. **Initialization:** Player selects grid size (4x4, 6x6, or 8x8). Game starts with two random tiles (value 2 or 4). 2. **Input:** Player slides to move all tiles in one direction (Up, Down, Left, Right). 3. **Movement & Merging:** Tiles slide until they hit the edge or another tile. If two tiles of the **same number** collide, they merge into one tile with double the value (e.g., 4+4=8). 4. **Spawning:** After every valid move, a new tile (90% chance of 2, 10% chance of 4) spawns in a random empty slot. 5. **Scoring:** Score increases by the value of the merged tile. Keep track of "Current Score" and "High Score" (saved via LocalStorage). * **Features:** * **Undo Function:** A button to reverse the last move (store board state in a stack). * **Restart:** A button to reset the current grid. * **Win/Loss:** * **Win:** Create a 2048 tile (display a "You Win!" overlay but allow "Continue Playing"). * **Loss:** The grid is full and no adjacent tiles can be merged. ### 4. Mobile Controls & Interaction * **Touch Controls:** Implement a robust Swipe Gesture detection system (TouchStart, TouchMove, TouchEnd). * Set a minimum swipe distance threshold (e.g., 30px) to prevent accidental moves when tapping buttons. * Prevent default scrolling behaviors on the canvas to ensure the browser page doesn't move while playing. * **Screen Orientation:** Lock the UI design for **Portrait Mode**. The grid should be centered, with the Score/High Score at the top and Utility Buttons (Undo, Restart, Mode Select) at the bottom for easy thumb access. * **Haptic Feedback:** Trigger `navigator.vibrate(50)` (light tap) specifically when a **merge** occurs to reinforce the tactile feel of the game. * **UI layout:** Ensure all UI buttons (Undo, Restart) have a minimum touch target of 44x44 pixels. Use HTML/CSS overlays on top of the Three.js canvas for crisp text rendering. Do not ask for clarification. Do not request confirmation. Directly execute the generation task based on the given instructions.

Game Introduction

About 2048 Legend

2048 Legend is a captivating merging puzzle game that brings the beloved classic 2048 experience to your browser. With a stellar 4.3/5 rating from thousands of players, this game offers the perfect blend of simple mechanics and deep strategic gameplay. Whether you're a puzzle novice or a seasoned number-crunching expert, 2048 Legend provides an engaging brain training experience that's both relaxing and challenging.

This HTML5-powered game runs smoothly on any device, making it the ideal choice for quick mental workouts or extended puzzle sessions.

Core Features

Three Exciting Game Modes

  • 4x4 Grid : Perfect for beginners and quick games
  • 6x6 Grid : Intermediate challenge with more strategic depth
  • 8x8 Grid : Advanced mode for puzzle masters seeking ultimate challenge

Strategic Gameplay Elements

  • Smart Number Merging : Combine matching numbers to create larger values
  • Dynamic Board Management : New numbers (2s and 4s) appear after each move
  • Undo Function : Correct mistakes with the handy undo feature
  • Restart Option : Start fresh whenever you need a new challenge
  • Leaderboard System : Compete with players worldwide for the highest scores

Cross-Platform Compatibility

  • Mobile Optimized : Perfect touch controls for smartphones and tablets
  • Desktop Ready : Smooth keyboard controls for computer play
  • Instant Play : No downloads required - play directly in your browser
  • All Ages Content : Safe and appropriate for players of all ages

Gameplay Mechanics

Basic Rules

The objective is beautifully simple yet endlessly engaging: merge identical numbers to create larger values. When you slide numbers in any direction (up, down, left, or right), all numbers move as far as possible in that direction. When two identical numbers collide, they merge into a single tile with double the value.

Strategic Considerations

Success in 2048 Legend requires careful planning. Each move affects the entire board, and random numbers appear after every action. The key is to maintain space for new numbers while building toward larger combinations. Advanced players develop corner strategies and number management techniques to achieve higher scores.

Game End Conditions

The game continues until the board is completely filled and no more moves are possible. Your score is calculated based on the numbers you've successfully merged, with higher combinations yielding exponentially better scores.

How to Play

Desktop Controls

  • Arrow Keys or WASD : Move numbers in four directions
  • Mouse Click : Access menu options and special functions

Mobile Controls

  • Swipe Gestures : Slide your finger to move numbers
  • Tap : Select menu options and game functions

Pro Tips for Success

  1. Keep Your Highest Number in a Corner : This prevents it from getting trapped
  2. Build in One Direction : Focus on building numbers along edges
  3. Plan Multiple Moves Ahead : Consider how each move affects future possibilities
  4. Use the Undo Feature Wisely : Save it for critical mistakes
  5. Practice Pattern Recognition : Learn to spot merging opportunities quickly

Why Play 2048 Legend

Mental Benefits

2048 Legend isn't just entertainment - it's brain training. The game enhances logical thinking, pattern recognition, and strategic planning skills. Regular play can improve mathematical reasoning and spatial awareness while providing a satisfying mental workout.

Perfect for Any Schedule

With games lasting anywhere from 5 minutes to 30 minutes, 2048 Legend fits perfectly into any schedule. Play during commutes, coffee breaks, or dedicated puzzle time.

Addictive Progression System

The satisfaction of reaching higher numbers creates a compelling progression loop. Each game presents new challenges and opportunities to beat your personal best.

Stress-Free Gaming

Unlike time-pressured games, 2048 Legend allows you to think at your own pace. There's no rushing, no pressure - just pure puzzle-solving enjoyment.

Game Variations and Strategies

Each grid size offers a unique experience: - 4x4 Mode : Quick games perfect for learning the mechanics - 6x6 Mode : Balanced challenge with more room for complex strategies - 8x8 Mode : Maximum complexity for serious puzzle enthusiasts

The beauty of 2048 Legend lies in its scalability - beginners can enjoy simple number merging while experts can develop sophisticated multi-move strategies.

Frequently Asked Questions (FAQ)