hi! I love Tetris, and so I decided to get even more familiar with the game (and conveniently learn some JavaScript) by programming my own version of it. I used to play a lot of ranked Tetris on Tetrio, which I highly recommend checking out if you have some spare time.
open index.html in your browser of choice, or navigate to this link!
- scoring system
- wall kicks: allow pieces to rotate and "kick back" even if they are against a wall
- see for more info: Tetris SRS
- ghost piece: add a "ghost" of where the piece would land
- input handling: currently using
keydownevents making the movement speed dependent on the user's OS, to be udpated to a polling(?) input system to eliminate this factor - co-op multiplayer mode: a version where players can team up with each other so that my friends are willing to play with me (a 4v1 should be more fair, right..?)
while I built this project from scratch (yes, this is hand coded), I did reference the following resources to get me started and for some specific algorithms:
- matrix rotation: StackOverflow
- fisher-yates shuffle: Wikipedia
- MDN web docs: Mozilla Web Docs
- reference implementation (a functional, classless implementation I referenced to help understand the game logic): Basic Tetris HTML and JS game