Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

2048

A fully functional clone of the popular 2048 puzzle game built entirely with vanilla HTML, CSS, and JavaScript.

Gameplay

Tiles slide on a 4×4 grid when you press an arrow key. Two tiles with the same number merge into one when they collide, doubling their value. The goal is to create a tile with the number 2048.

  • Desktop: Arrow keys or WASD
  • Mobile: Swipe in any direction
  • Each move spawns a new tile (90% chance of 2, 10% chance of 4)
  • Your score increases by the sum of all merged tiles each turn

Features

  • Smooth animations — CSS transitions for tile movement, keyframe animations for tile spawns and merges
  • Score persistence — Best score saved to localStorage
  • Win/loss detection — Notifies on reaching 2048 with a "Keep Going" option; ends when no moves remain
  • Responsive — Adapts layout and tile sizing for mobile viewports
  • Touch support — Swipe gestures for mobile play
  • Zero dependencies — No frameworks, no libraries, no build step

Project Structure

├── index.html    — Game markup
├── style.css     — Visual design, layout, and animations
├── script.js     — Game engine, DOM rendering, and event handling
└── README.md     — Project documentation

Running Locally

Clone the repo and open index.html in any modern browser:

git clone https://github.com/burny143/2048-game.git
cd 2048-game
start index.html

No server or build tools required.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages