Coder Social home page Coder Social logo

hasnatrasool163 / tetris-in-java Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 49.91 MB

This repository contains full tetris game implementation in Java swing and awt.

Java 100.00%
awt-gui java javaawt javaswing javaswingsapp swing-gui tetris tetris-clone tetris-game tetrisgame

tetris-in-java's Introduction

Java Tetris Game

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.

Features

  • 7 Tetrominoes (Minos): Includes all classic Tetris blocks.
  • Game Controls: Easy-to-use keyboard controls for moving, rotating, and dropping tetrominoes.
  • Line Clearing: Complete lines to clear them from the board and earn points.
  • Levels: The game speed increases as you progress, offering a challenging experience.
  • Score System: Earn points by clearing lines and advancing through levels.
  • Pause/Resume: Players can pause the game at any moment and resume where they left off.
  • Collision Detection: Ensures a realistic gameplay experience.
  • Music and Sound Effects: Enhances gameplay with engaging audio.

ScreenShots

Screenshot (813)

Getting Started

Prerequisites

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.

Installation

  1. Clone the repository to your local machine using Git:

    git clone https://github.com/hasnatrasool163/Tetris-in-Java.git
  2. Navigate to the cloned directory:

    cd java-tetris-game
  3. Compile the Java files. For example, if your main class is in tetris.Game, you would run:

    javac tetris/Game.java
    javac Main.java
  4. Run the game:

    java tetris.Game
    java Main

How to Play

  • Move Left: Arrow key left /A
  • Move Right: Arrow key right / D
  • Rotate: Up arrow key / W
  • Drop: Down arrow key / S
  • Pause/Resume Game: Press 'SpaceBar'

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.

Built With

  • Java - The programming language used
  • Swing and AWT - Used for the GUI components

Authors

  • Muhammad Hasnat Rasool - Initial work - YourGitHub

Acknowledgments

  • Hat tip to anyone whose code was used
  • Inspiration
  • etc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.