|
1 | | -# Tetris-in-Java |
2 | | -This repository contains full tetris game implementation in Java swing and awt. |
| 1 | +# Java Tetris Game |
| 2 | + |
| 3 | +This Tetris game is developed using Java's Swing and AWT libraries, offering a classic gaming experience with modern coding practices. The game features the traditional Tetris gameplay, including 7 different tetrominoes, with additional features such as pause, score tracking, line clearing, level progression, collision detection, and background music to enhance the playing experience. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **7 Tetrominoes (Minos):** Includes all classic Tetris blocks. |
| 8 | +- **Game Controls:** Easy-to-use keyboard controls for moving, rotating, and dropping tetrominoes. |
| 9 | +- **Line Clearing:** Complete lines to clear them from the board and earn points. |
| 10 | +- **Levels:** The game speed increases as you progress, offering a challenging experience. |
| 11 | +- **Score System:** Earn points by clearing lines and advancing through levels. |
| 12 | +- **Pause/Resume:** Players can pause the game at any moment and resume where they left off. |
| 13 | +- **Collision Detection:** Ensures a realistic gameplay experience. |
| 14 | +- **Music and Sound Effects:** Enhances gameplay with engaging audio. |
| 15 | + |
| 16 | +## Getting Started |
| 17 | + |
| 18 | +### Prerequisites |
| 19 | + |
| 20 | +Ensure you have Java Development Kit (JDK) installed on your machine to run and compile the game. The game is developed and tested with JDK version 21. |
| 21 | + |
| 22 | +### Installation |
| 23 | + |
| 24 | +1. Clone the repository to your local machine using Git: |
| 25 | + |
| 26 | + ```bash |
| 27 | + git clone https://github.com/hasnatrasool163/Tetris-in-Java.git |
| 28 | + ``` |
| 29 | + |
| 30 | +2. Navigate to the cloned directory: |
| 31 | + |
| 32 | + ```bash |
| 33 | + cd java-tetris-game |
| 34 | + ``` |
| 35 | + |
| 36 | +3. Compile the Java files. For example, if your main class is in `tetris.Game`, you would run: |
| 37 | + |
| 38 | + ```bash |
| 39 | + javac tetris/Game.java |
| 40 | + ``` |
| 41 | + |
| 42 | +4. Run the game: |
| 43 | + |
| 44 | + ```bash |
| 45 | + java tetris.Game |
| 46 | + ``` |
| 47 | + |
| 48 | +## How to Play |
| 49 | + |
| 50 | +- **Move Left:** Arrow key left /A |
| 51 | +- **Move Right:** Arrow key right / D |
| 52 | +- **Rotate:** Up arrow key / W |
| 53 | +- **Drop:** Down arrow key / S |
| 54 | +- **Pause/Resume Game:** Press 'SpaceBar' |
| 55 | + |
| 56 | +The objective is to place the tetrominoes to create complete lines, which will then be cleared from the board. The game ends when the Tetris playfield is filled. |
| 57 | + |
| 58 | +## Built With |
| 59 | + |
| 60 | +- [Java](https://www.java.com/) - The programming language used |
| 61 | +- [Swing](https://docs.oracle.com/javase/tutorial/uiswing/) and [AWT](https://docs.oracle.com/javase/tutorial/awt/) - Used for the GUI components |
| 62 | + |
| 63 | +## Authors |
| 64 | + |
| 65 | +- Muhammad Hasnat Rasool - *Initial work* - [YourGitHub](https://github.com/yourusername) |
| 66 | + |
| 67 | + |
| 68 | +## Acknowledgments |
| 69 | + |
| 70 | +- Hat tip to anyone whose code was used |
| 71 | +- Inspiration |
| 72 | +- etc |
0 commit comments