Skip to content

Tetris is a simple 2D Tetris game developed by Java, Assignment of Advanced Programming, Sharif University of Technology

Notifications You must be signed in to change notification settings

benyaminbeyzaie/tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TETRIS

A Simple TETRIS game with one external command which is named TOOBEH. I'm not a native English speaker be ready for some possible language flaws :)

gif

Resourse and librarys

How to play

gif

  • Q : Rotate left
  • W : Undo the current move (TOOBEH)
  • E : Rotate right
  • A : Move left
  • S : Speed up!
  • D : Move right
  • ENTER : start a new game (if you press ENTER before your lost, your score won't be saved! but you can start a new game when ever you want!)

How it works?

public static void main(String[] args) {
        Game game = new Game();
        game.start();
    }

All the game loop and stuff runs on a new thread I don't know how to use thread professionally but I just want to try it this way!

Main class is Game.java which also implements Runnable and KeyListener interfaces dou to run and listen to the players commands. I did my best to write that code functional and neat.

logic package and gfx package are separated and Game.java class draw stuffs on the display based on logic part by connecting this two parts to each other.

For saving top scores of all times I have used json. it's pretty simple. also for better performance I have created Assets.java class dou to load each graphical files just one time over the game.

I need to point out that the center of the era of all shapes is not same so if you can't rotate a shape in some places don't panic :) just think of a diffrent center of the era.

About

Tetris is a simple 2D Tetris game developed by Java, Assignment of Advanced Programming, Sharif University of Technology

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages