A classic 2048 game implemented using Pygame, featuring smooth animations for tile movements. This game is a fun and addictive sliding tile puzzle game that you can play directly on your computer.
- Smooth tile movement animations
- Simple and intuitive controls
- Real-time score updates
- Game over detection
- Visually appealing design
- Clone the repository:
git clone https://github.com/nekros0day/2048-game.git
- Navigate to the project directory:
cd 2048-game
- Install the required dependencies:
pip install pygame
-
Run the game:
python 2048.py
-
Controls:
W
- Move tiles upS
- Move tiles downA
- Move tiles leftD
- Move tiles right
-
Objective:
- Combine tiles with the same number to create a tile with the number 2048.
- When there are no more possible moves, the game is over.
2048.py
: The main game file containing all the logic and rendering code.Tile
class: Represents each tile in the game with its value and position.- Game logic:
initialize_game()
: Sets up the initial game state with two tiles.add_new_tile(board)
: Adds a new tile to the board at a random empty position.move(board, direction)
: Moves and merges tiles based on the input direction.calculate_score(board)
: Calculates the current score by summing the values of all tiles.
Contributions are welcome! If you find any bugs or have suggestions for improvements, feel free to open an issue or create a pull request.
- Fork the repository
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add some feature"
- Push to the branch:
git push origin feature-name
- Open a pull request
- Inspired by the original 2048 game created by Gabriele Cirulli.
Happy playing! 🎮