Tetris is a tile-matching video game created by Russian software engineer Alexey Pajitnov in 1984. It has been published by several companies, most prominently during a dispute over the appropriation of the game's rights in the late 1980s. After a significant period of publication by Nintendo, the rights reverted to Pajitnov in 1996, who co-founded The Tetris Company with Henk Rogers to manage Tetris licensing.
https://wilsontbx.github.io/Tetris/
- HTML
- CSS
- Javascript
Not required
- Then block will generate from top of board. Player can press arrow key up to rotate the block, left and right arrow key to move left and right.
- Arrow key down is to move block down and space bar is for instant drop to last position, however the block will move down automatically according to speed table below.
- Once block hit the ground, it will become solid block and unable to move. Then new block will generate from top of board. Simultaneously, when controled block hit existing solid block, it will joint the solid block.
- Once row/line filled up with full block, it be will clear and bring existing solid block structure down 1 row. Then score will given
- When certain number of line is cleared arroding table below. The game will level up and increae the speed to move block down.
- There is function key like "1" for level up, "2" for show forecast of block final postion, "3" for show the grid of board
- There is cheat code to clear all the block : "O"
Level | Frames per Grid | Lines to advance |
---|---|---|
00 | 48 | 5 |
01 | 43 | 10 |
02 | 38 | 15 |
03 | 33 | 20 |
04 | 28 | 25 |
05 | 23 | 30 |
06 | 18 | 35 |
07 | 13 | 40 |
08 | 8 | 45 |
09 | 6 | 50 |
10-12 | 5 | 50 |
13-15 | 4 | 50 |
16-18 | 3 | 55-65 |
19-28 | 2 | 70-115 |
29+ | 1 | 120 |
- speed is based frames per grid, speed = frame/60, 1 seconds = 60 frame
- after level 29, frames per grid will remain 1, lines to advance will add 5 line per level
- Choosing the right method to start.
- Use canvas to draw and generate board
- Study requestAnimationFrame to update canvas
- Board checking to make sure the block wouldnt go out of box for bottom line
- check left and right cannot go out box
- Rotote in side of board will cause piece go outside box
- After rotate block and colilde the new genarate block will same
- Delayed Auto Shift (DAS) behavior
- random block autopop, solve via always declare value inside loop
- Enhancement for pause and side menu
- Enchacement to do forecast block
- Support gamepad
- Allow 2 player in game
- Better clear line animation