2048 is a classic puzzle game where the goal is to combine identical tiles on the game board to reach the tile with the number 2048.
This project implements the 2048 game using JavaScript, HTML, and CSS/SCSS. The player can move the tiles in four directions (up, down, left, right) and combine identical tiles to increase the score. The game includes animation score updates, as well as functionality to start and restart the game.
- JavaScript: Game logic and DOM manipulation.
- HTML: Markup for displaying the game.
- CSS/SCSS: Styles for the visual design and animations of the game.
- Tile movement in four directions (up, down, left, right).
- Merging tiles with identical values.
- Adding new tiles to random empty spots.
- Game restart functionality.
- Displaying the current and best scores.
- ES6+ syntax (e.g.,
let
,const
, template literals, destructuring, etc.). - Strict mode (
'use strict';
) is used to enforce better error handling. - Classes are used for game logic, with clear method separation.
- Variables are named using camelCase.
- Constants are written in UPPERCASE with underscores.