This is a simple implementation of the popular 2048 game using HTML, CSS, and JavaScript. The game is designed to be played in a web browser and is a fun and challenging puzzle game where the goal is to combine tiles to reach the 2048 tile.
-
Accessing the Game: You can play the game by opening the
index.html
file in your web browser. No additional installation or setup is required. -
Game Rules: The game is played on a 4x4 grid. You can use your arrow keys (up, down, left, right) to move the tiles. When two tiles with the same number collide while moving, they merge into one tile with the sum of their values. The goal is to create a tile with the value of 2048.
-
Scoring: Your score is displayed in the top-left corner. Each time two tiles merge, your score increases by the value of the merged tiles.
-
Winning: The game is won when a tile with a value of 2048 is created. You can continue playing after winning to achieve a higher score.
-
Losing: The game is lost when the grid is full, and no more moves can be made.
-
Restart: You can restart the game at any time by clicking the "New Game" button.
index.html
: The main HTML file that contains the game board and user interface.2048.css
: The CSS file that defines the game's styling and layout.2048.js
: The JavaScript file that contains the game logic and functionality.images/
: This directory contains the images used for tiles.
You can customize the game by modifying the CSS and JavaScript files. Here are some things you can do:
-
Styling: You can change the colors, fonts, and overall styling of the game by editing the
2048.css
file. -
Game Logic: If you want to modify the game rules or add new features, you can do so by editing the
2048.js
file. Be sure to have a good understanding of JavaScript and the existing code before making significant changes. -
Grid Size: If you want to change the grid size, you'll need to make adjustments to the HTML structure and CSS to accommodate a different grid size.
This game is based on the original 2048 game created by Gabriele Cirulli. You can find the original game and its source code here: 2048 Game by Gabriele Cirulli.
This project is open-source and available under the MIT License. You are free to use, modify, and distribute the code as long as you include the appropriate attribution and adhere to the terms of the MIT License.
Have fun playing 2048! If you have any questions or feedback, please feel free to open an issue or contribute to this repository. Enjoy the game!