For this game, I simply pretended that someone had requested I create Tetris so that it ran using only standard Java with zero external libraries(for better or worse). Until the very end, I relied on my existing knowledge from prior games without looking up solutions elsewhere. It really helped me identify which areas I need to improve on the most.
The area it turned out I needed vast improvement was sound programming. Ended up scouring the web for various solutions for one-shot playing of *.wav sound files with minimal lag and decent stability.
I don’t believe this game is perfect in its current state by any means, there’s a few things I’d like to add. The only feature I know I will add is a high-score table instead of the current single high score being saved.
The scoring rules are very similar to the classic NES version of Tetris. More lines cleared at once yields more points than single line clearing. Forcing a piece down gives points based on the distance traveled.
The tetraminoes are randomized to a certain extent. Within seven pieces, they will not repeat. Once a set is cleared, a new one is created. Not sure how fair this is. A possibility is remembering the last 3 or 4 pieces and randomizing them based on that, to help create more variety.
Game speed starts slow, but becomes very difficult level 18+. I’m not a very skilled Tetris player so I don’t know if it’s possible to survive past level 20 with the way I’ve programmed Jetris. If there’s any expert players within the JGO community I’d love to hear your thoughts on this.
Controls:
W or UP - Rotate current piece clockwise.
E - Rotate current piece counter-clockwise.
A & D or LEFT & RIGHT - Move current piece horizontally.
S or DOWN - Force current piece down. If released before the piece lands, bonus points will not be rewarded.
ENTER - Start game, pause game, or begin new game after a game over.
ESCAPE - Return to main menu from pause screen.
All assets were produced by myself and my son Jack(He was attached to my side through most of this.)
Sounds were recorded with Audacity using household objects.
The simple graphics were made with GraphicsGale Free Edition.
[Update]
Download from DropBox here
Added counter-clockwise rotation. Pressing E will rotate it in that direction.
Improved difficulty curve.
Force Drop speed increased.
If you encounter a bug, experience excessive lag, the game crashes, or you have a suggestion, I’d be happy to hear from you.
Decided to share the source code for this project in case anyone wanted to pick it apart. Perhaps someone still learning can take something from it.
Keep in mind this isn’t perfect code by any means, it just does what I wanted it to do. There’s some stuff in there that I’m sure wasn’t the right way to go about it, just did it the only way I knew how.
Welp, here’s the source.
It’s an Eclipse project, so if I did it right, you “should” be able to just import it into your workspace.