Inspiration

We liked playing Tetris very much, so we decided to make a twist on our favorite game with new music and rules, hence the name Sirtet, which is Tetris backwards.

What it does

The program generates random tetrominoes (4 block figures) with random colors, which then drop at a rate that gets faster as the levels go on. The player can control the tetromino by pressing left or right to move horizontally, while the down key (also known as soft drop) makes the tetromino go down faster. There is also an option of "hard drop", which automatically drops tetromino until it collides with the ground or another tetromino, that operates when the space bar is pressed. The up arrow is used to rotate the tetromino. Our twist on the familiar classic version of Tetris is that instead of clearing pieces by completing rows, the player clears the pieces based on the color of the pieces. For our program, a player had to match 10 or more blocks of the same color to clear the those pieces. The player receives points for clearing pieces, using hard drop, and using soft drop. The player begins in level one, and advances a level every 1000 points. The rate of which the tetriomino drops also increases as the player levels up. Once the tetromino reaches a certain height, the game ends with a game over message, and the controls are disabled. We also added in an audio file to the program so that background music would play as the player plays the game. The music stops when the game is over.

How we built it

For the movement options, we used KeyListener to detect which key was being pressed. For example, the pressing of the left, right, up arrows and space bar would be detected by KeyListener, then carried out as operations to either move the tetromino left, right, hard drop, soft drop or rotate. For the clearing of pieces, we used floodfill to go through the blocks that had the same color and are connected to each other.To incorporate audio into the game, we imported, then used AudioInputStream. We also used Graphics and JFrame to show the score, level number, game over, and the level up messages.

Challenges we ran into

The audio was difficult to add because it was a new concept for us. We also had some problems with floodfill because we ran into many problems with recursion. The hard drop, also, would sometimes pass through pieces, so we had to improve collision detection to solve this issue.

Accomplishments that we're proud of

We managed to incorporate the audio into the program in a loop so that the music would not end unless the game ends. The hard drop operation took a while to debug and fix.

What we learned

We learned how to use JFrame, Thread, and to incorporate audio into a program importing AudioInputStream.

What's next for Sirtet

We would like to add gravity, which would make the piece fall when it has no other pieces under it, in stead of being suspended in the grid. We would also like to add a feature showing the next piece, and better graphics in general.

Built With

  • audioinputstream
  • floodfill
  • java
  • jframe
  • keylistener
  • point
  • random
  • recursion
  • threads
Share this project:

Updates