Skip to content

Repository files navigation

The 2048

A modern, mobile-friendly implementation of the classic 2048 game built with React Native and Expo.


Gameplay Instructions

  • Objective: Slide numbered tiles on a grid to combine them and reach the 2048 tile.
  • Controls:
    • Swipe: Use swipe gestures (up, down, left, right) to move tiles.
  • Winning: Reach the 2048 tile to win the game.
  • Game Over: The game ends when no moves are possible.

Installation & Running

  1. Clone the repository:
   cd The2048
  1. Install dependencies:
  npm install
  1. Start the development server:
  npx expo start

Follow the on-screen instructions to open the app in an emulator or on a physical device.


Implementation Details

  • Game Logic:

    • The game board is a 4x4 grid initialized with two random tiles.
    • Tiles slide and merge according to 2048 game rules.
    • The game checks for win and game-over conditions after each move.
    • Functions like slideLeft, slideRight, slideUp, and slideDown handle movement and merging logic.
  • User Interface:

    • The app features a responsive layout with a Midnight Neon theme.
    • Includes modals for "How to Play" and game-over scenarios.
    • Score tracking is displayed prominently.
    • Board size is configurable from 2x2 to 8x8.
    • Buttons for restarting and adjusting board size.
  • Technologies Used:

    • React Native with Expo for cross-platform development.
    • Gesture handling using react-native-swipe-gestures.
    • State management using React's useState and useMemo.

Future Enhancements

  • Undo Feature: Allow players to undo their last move.
  • High Score Tracking: Implement local storage to save high scores.
  • Sound Effects: Add audio feedback for tile movements and merges.
  • Multiplayer Mode: Enable two-player mode for competitive play.
  • Themes: Offer additional color themes for customization.

Developer Details

About

A modern, mobile-friendly implementation of the classic 2048 game built with React Native and Expo.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages