Description of the project
This website was created by Josh Meritt who is a senior at SUNY Oswego who is majoring in computer science and minoring in information science. Being a big fan of Tetris, the goal of this project is to create a replication of the original game of Tetris, but with a few changes for ease of the project.
The controls of the game:
'D' - right
'W' - hard drop
'Enter' - rotate
'Space' - hold
Process of how the game runs:
- A 10 x 20 board is created along with the different types of Tetrominoes (Pieces).
- A random piece is then generated to spawn at the top middle of the board and slowly fall.
- Each Piece can be moved to the right, left, down or rotated.
- As each piece is moved in any of the previously stated directions, it is undrawn from the previous and then redrawn after the move.
- If the Piece hits a wall or another Piece that has already fallen: That Piece is then locked into place and three scenarios can happen:
- The Piece could go past the top row and result in game over.
- The Piece can fill up a row and the row must be cleared and all above rows must be moved downward. In this case, the score must be changed.
- The Piece can be locked into position without clearing a line.
- Step 3 is repeated until game over.
What could be improved
While the game currently runs fine, some improvements could be made to increase the quality of the game such as:
- For the Piece that is being held, it could be shown in some sort of way. Currently relies on the player to remember what Piece is being held.
- Upcoming Pieces could also be shown instead of being generated when needed.
- Better system to either prevent spamming moves; one can currently just go left and right forever and not move down if I removed keys pressed counter.
The code for this project can be found on GitHub.