< Back

2048

2048 is a classic sliding tile puzzle game. The objective of the game is to combine tiles with the same number to create larger numbers, ultimately reaching the tile with the number 2048.

Play to combine tiles and reach the 2048 tile at iamdatphan.github.io/2048.

How to Play

  1. Use the arrow keys (or W, A, S, D) to slide the tiles in the desired direction.
  2. When two tiles with the same number collide, they merge into one tile with their sum.
  3. Continue sliding and merging tiles until you reach the 2048 tile or no more moves are possible.

Features

  • Responsive Design: The game adapts to different screen sizes for an optimal experience.
  • Smooth Animations: Tiles move and merge with smooth transitions and animations.
  • Keyboard Controls: Use arrow keys or W, A, S, D (or H, J, K, L) for movement.

Technologies

  • HTML
  • CSS
  • JavaScript

Project Structure

  • index.html: The main HTML file that sets up the game board.
  • styles.css: Contains the styles for the game, including grid layout and tile animations.
  • script.js: The main JavaScript file that handles game logic and user input.
  • grid.js: Defines the Grid and Cell classes for managing the game board.
  • tile.js: Defines the Tile class for creating and managing individual tiles.