Skip to content

mikezhylka/js_2048_game

 
 

Repository files navigation

2048 Game

A browser-based implementation of the classic 2048 puzzle game built with JavaScript. Combine tiles to reach the magic number—2048—while honing your strategy and enjoying a smooth, interactive UI.

2048 game GIF

🎮 Gameplay

  • Goal: Slide numbered tiles on a 4x4 grid to combine them into a tile with the value of 2048.
  • How to Play: Use arrow keys to move tiles. Tiles with the same value merge, creating a new tile with double the value. Keep combining tiles until you reach 2048—or run out of moves!
  • Win/Loss: Win by reaching 2048. The game is over when no valid moves remain.

✨ Features

  • Smooth Gameplay: Intuitive controls and animations for a satisfying player experience.
  • Responsive Design: Works well across devices and screen sizes.
  • Random Tile Generation: After each move, a new tile (2 or 4) spawns randomly, adding challenge.
  • Scoring System: Tracks your score with each move, encouraging higher scores.
  • Restart Option: Reset the board at any time with a click of a button.

📂 Project Structure

  • src/modules/Game.class.js: Core game logic and mechanics, including tile merging and move validation.
  • src/index.html: Main layout and structure for the game interface.
  • main.js: Connects UI elements with game logic and manages event handling.

🚀 Technologies

  • JavaScript: Game logic and interactions
  • HTML & CSS: Responsive layout and styling

🧩 Try it Out

You can play the game here or clone this repository to try it locally.

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 85.8%
  • SCSS 8.2%
  • HTML 6.0%